From:             
Operating system: Linux
PHP version:      5.2.13
Package:          Session related
Bug Type:         Bug
Bug description:Unable to disable implicit session locking

Description:
------------
I would like to run to requests in parallel in the same session, i.e. have
two instances of a php script run simultaneously.



To demonstrate, please see the attached code (it will print 60 | chars with
a second in between):



Next, simply open two tabs in your browser and call the script from both
tabs.



If it is working as I hope, you will notice that they will not run in
parallel (as I was hoping), but instead the script will start executing in
one of the tabs, while the other will appear to hang. After the script in
this tabs finishes (after one minute), the next tab will start executing.



I have tried different approaches for achieving explicit locking, mainly
using session_set_save_handler
(http://theserverpages.com/php/manual/en/function.session-set-save-handler.php),
but to no effect - the locking is effective no matter what I come up with.



These are some pages that mention solutions for explicit locking, but none
appear effective:



-
http://thwartedefforts.org/2006/11/11/race-conditions-with-ajax-and-php-sessions/



- http://www.tonymarston.co.uk/php-mysql/client-clones.html



- http://blog.perplexedlabs.com/2009/10/05/php-custom-session-handler/



So, it appears to me that session_set_save_handler() is buggy - or am I
just naively hoping it will work for me for a purpose it doesn't support?



Test script:
---------------
<?php

print "[";



for($i = 0; $i < 100; $i++){

  $spaces.="<!-- bufferme -->";

} // for



//and then



for($i = 0; $i < 60; $i++){

  for($ii = 0; $ii < 200000; $ii++){

    //do something slow here

  } // for

  sleep(1);

  print "$spaces|";

  flush();

} // for



print "]";



?>

Expected result:
----------------
Both scripts running in parallel.

Actual result:
--------------
Scripts executing one at a time.

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51264&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51264&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51264&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51264&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51264&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51264&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51264&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51264&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51264&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51264&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51264&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51264&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51264&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51264&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51264&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51264&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51264&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51264&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51264&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51264&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51264&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51264&r=mysqlcfg

Reply via email to