[TYPO3-core] RFC: #7333: Solution for "Page is being generated"

Michael Stucki michael at typo3.org
Sat Feb 2 02:04:40 CET 2008


Oliver Hader wrote:

> Bernhard Kraft schrieb:
>> Additional: Instead of just using "flock" the patch should try to
>> use mutex-locks if available (better thread safety) and just use
>> file-locks as a fallback.
> 
> Did you research for such mutex or concurrent helper functionalities or
> know of something similar. The PHP documentation on flock() states, that
> some filesystems might have problems with flock(), e.g. NFS.
> Well, such live network shares are quite often used...

As Masi already pointed out, the filesystems are not a problem.
However, if you use a multithreaded API, flock causes strange behaviours.

It's actually documented on php.net but it took me several hours to realize
that this is the problem!

I'm running PHP5 with Apache2-worker and mod_fcgid [1] and had the following
problem:

1) Apply Bernhards patch
2) Add a debug comment at the beginning of $TSFE->lockPageGenerate()
3) Add a sleep(5) call at the beginning of $TSFE->realPageCacheContent()

Then, do this:
1) Clear the cache
2) Load a page and see the debug statement from above
3) Reload the page: Since it's now fetched from the cache, the debug is gone
4) In another browser window, load a different page
5) within the 5 seconds of sleep time, reload the first page and see what
   happens:

=> Although the page is already cached and does not enter the
lockPageGenerate() method, it will wait until the other page has released
the lock.

In other words: Whenever a page is being generated, all other pages are
stopped.

As I consider mod_fcgid/apache2-mpm-worker as a great improvement and
therefore think that we should not at all rely on the flock()
functionality. I'm going to try to use mutex-locks and see if this works
better...

- michael

[1]
http://buzz.typo3.org/people/stucki/article/how-to-use-different-php-versions-on-one-server/
-- 
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/


More information about the TYPO3-team-core mailing list