[#2913] memcached session locking
Summary memcached session locking
Queue Horde Framework Packages
Queue Version HEAD
Type Enhancement
State Resolved
Priority 1. Low
Owners Horde Developers
Requester adrieder (at) sbox (dot) tugraz (dot) at
Created 11/03/2005 (1162 days ago)
Due
Updated 02/22/2007 (686 days ago)
Assigned 11/03/2005 (1162 days ago)
Resolved 12/02/2005 (1133 days ago)
Attachments memcached.php[1].patch Download
memcached.php.patch Download
Milestone
Patch No

History
02/22/2007 Jan Schneider Comment #10 Reply to this comment
Wouldn't it make more sense to store a lock key in the memcache server 
instead of relying on a shared file system for locking?
12/06/2005 adrieder (at) sbox (dot) tugraz (dot) at Comment #9 Reply to this comment
There is still a bug in the driver:

the function _unlockSession() should not take a parameter at line 233

12/05/2005 Chuck Hagenbuch Deleted Attachment: memcached.php[2].patch
 
12/05/2005 kevin_myer (at) iu13 (dot) org Comment #8 Reply to this comment
I'd propose a slightly different fix - if you call _unlockSession
without an $id, it's doing nothing.

I think this patch would be desired behaviour - remove the flock,
then remove the file itself.
Argh, except, close() isn't setup to take $id as an argument, so that 
call to _unlockSession fails..  I missed the introduction of the $_fp 
resource.  In which case, the original patch is more or less correct.

12/05/2005 kevin_myer (at) iu13 (dot) org Comment #7
New Attachment: memcached.php[2].patch
Reply to this comment
Cool. I've cleaned it up and committed it to HEAD and FRAMEWORK_3. Thanks!
I noticed that you cleanups introduced a small bug. The close() function doesn't have an argument. I attached a patch
which should deal with this problem,
I'd propose a slightly different fix - if you call _unlockSession 
without an $id, it's doing nothing.

I think this patch would be desired behaviour - remove the flock, then 
remove the file itself.

12/02/2005 adrieder (at) sbox (dot) tugraz (dot) at Comment #6
New Attachment: memcached.php[1].patch Download
Reply to this comment
Cool. I've cleaned it up and committed it to HEAD and FRAMEWORK_3. Thanks!
I noticed that you cleanups introduced a small bug. The close() function doesn't have an argument. I attached a patch 
which should deal with this problem,

12/02/2005 Chuck Hagenbuch Comment #5
State ⇒ Resolved
Reply to this comment
Cool. I've cleaned it up and committed it to HEAD and FRAMEWORK_3. Thanks!
12/02/2005 adrieder (at) sbox (dot) tugraz (dot) at Comment #4 Reply to this comment
Is this patch stable/in use? I'm not clear exactly which versions the
people having trouble with memcached are using.
We use it since I posted it. 4 servers 10000 users. It works, which 
means we do not see the "message not found" problem anymore.
One thing is which I had do do additionally: Clean the tmp dir from 
stale session locks from time to time. Cronjob: find /tmp/lock_* \( 
-type f -amin +120 \) -exec rm -f {} \;
12/02/2005 Chuck Hagenbuch Comment #3
State ⇒ Feedback
Reply to this comment
Is this patch stable/in use? I'm not clear exactly which versions the 
people having trouble with memcached are using.
11/03/2005 Jan Schneider State ⇒ Assigned
Assigned to Horde DevelopersHorde Developers
 
11/03/2005 adrieder (at) sbox (dot) tugraz (dot) at Comment #2 Reply to this comment
Forgot to mention:
The idea and solution is based on  Gary Windham's <windhamg@email.arizona.edu>
memcached_flock driver. He kindly provided the code.
11/03/2005 adrieder (at) sbox (dot) tugraz (dot) at Comment #1
State ⇒ New
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ memcached session locking
Queue ⇒ Horde Framework Packages
New Attachment: memcached.php.patch Download
Reply to this comment
The attached patch helps to get around the "requested message not 
found" issue, which is due to no serialization of concurrent session 
access.