From:             cmaxwell at themanor dot net
Operating system: OpenBSD 3.2-stable
PHP version:      4.3.0
PHP Bug Type:     Session related
Bug description:  session_start() blocks execution of other scripts

This is a file locking/blocking issue.  While avoiding collision on the
session file may be a "feature", the behavior blocking execution and not
returning an error is a bug.

Run the following script from CLI php on two seperate consoles on the same
host.  

The first script will execute, start the session and, quite obviously, not
return.

The second script will start, but will never finish the session_start()
command, nor will it timeout, until the first process finishes.

---------
<?php
$sidnum = "fdc69822e43b7d9a1942f8bae9731e18";
session_id($sidnum);
print "STARTING SESSION....";
session_start();
print "STARTED";
while (1) {}
?>
---------

Some ideas for improved behavior:

 - accept an optional parameter to session_start() of "$nonblock" that
allows returning FALSE on blocking error.  This avoids breaking web-based
scripts that may rely on the TRUE return code.

 - new function wrapper session_start_nonblock() that has nonblocking
behavior and/or an error return code.

Both suggestions leave the onus of how to deal with undefined blocking
behavior up to the application.  

-- 
Edit bug report at http://bugs.php.net/?id=22462&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22462&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22462&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22462&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22462&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22462&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22462&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22462&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22462&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22462&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22462&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22462&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22462&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22462&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22462&r=gnused

Reply via email to