|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63716 improved session locking control through php.ini
Submitted: 2012-12-07 10:59 UTC Modified: 2021-03-25 16:36 UTC
From: marc dot neudert at gmail dot com Assigned: cmb (profile)
Status: Closed Package: memcache (PECL)
PHP Version: Irrelevant OS: irrelevant
Private report: No CVE-ID: None
 [2012-12-07 10:59 UTC] marc dot neudert at gmail dot com
The session locking introduced with pecl-memcache-3.0.4 uses a steadily 
increasing wait time (from 5ms up to 1000ms) until the session is unlocked.

When sending several parallel AJAX requests (or lots in fast succession), you 
often end up at the max waiting time of 1000ms. This could make apps somewhat 
unresponsive if they are heavily AJAX dependent.

@see #22462
@see #58726

Test script:

  $session = session_start();
  usleep(100000); // sleep 100 ms


<script language="text/javascript">
for (var i = 0; i < 10; i++) {
  xmlhttp=new XMLHttpRequest();"GET","http://localhost/session_lock.php?"+i,true);

Expected result:
In an optimal case (and without using session_write_close()) each of the 10 AJAX 
requests would be executed once the previous one is finished. Therefore taking 
around 1.x seconds for all 10 requests.

Actual result:
Due to the increasing locking wait times the total time taken is far beyond that 
(depending on the server you could expect 5s total).


session-locking-php.ini-configuration (last revision 2012-12-07 11:00 UTC by marc dot neudert at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-25 16:36 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-03-25 16:36 UTC]
The official bug tracker for PECL/memcache is now at

So, if this is still an issue with either of the current memcache
versions (4 or 8), please file an issue there.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Apr 23 08:01:24 2021 UTC