PHP 4.0 Bug #6287: serialized script execution with file sessions
| From: | omakarenko at cyberplat dot ru | Date: | Tue, 22 Aug 2000 06:25:56 +0000 |
| Subject: | PHP 4.0 Bug #6287: serialized script execution with file sessions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-30165@lists.php.net to get a copy of this message | ||
From: omakarenko@cyberplat.ru
Operating system: Linux, FreeBSD
PHP version: 4.0.1pl2
PHP Bug Type: Session related
Bug description: serialized script execution with file sessions
Long running php script with active file session blocks other requests from the same client. When
the session is started php is trying to flock() the session file and if it is already locked by
another process the script (and the whole apache process) hangs (or blocks). So all requests to php
pages from the same client are effectivly serialized :( The lock/unlock should be probably placed
only around read/write operations. The lock should not be held for the whole script lifetime...
BTW, the flock() is not released at all (!) when php script is called with ?=PHP_LOGO (where
PHP_LOGO is a long string of hex digits, see sources)... check the main/main.c... with
sessions.auto_start=1 the session IS started before you make PHPWRITE(image/gif) but it is NOT
closed on return... That blocks other client's requests for a VERY long time... Just try to
show php_info() with auto_start=1 (and expose_php=1 and enabled cookies in you browser)... see that
browser is still active trying to download some image (Zend logo actually)... press STOP and
shift-Reload... you are blocked... That problem is related to the first one in that while it can be
solved different ways the clean solution is to unlock the file after read() and to try to lock the
file again only before the write() (write() never happens with ?=PHP_LOGO/ZEND_LOGO/etc trick)...