php.net |  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: -
From: marc dot neudert at gmail dot com Assigned:
Status: Open Package: memcache (PECL)
PHP Version: Irrelevant OS: irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
20 - 4 = ?
Subscribe to this entry?

 
 [2012-12-07 10:59 UTC] marc dot neudert at gmail dot com
Description:
------------
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:
---------------
server-side:

<?php
  $session = session_start();
  usleep(100000); // sleep 100 ms
?>

client-side:

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

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).

Patches

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

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Oct 21 08:01:27 2019 UTC