Significant problem with current expiration code - fix included

Neulinger, Nathan nneul at umr.edu
Sat Sep 2 02:03:49 UTC 2006


I started diagnosing a weird issue with current facebook branch, and
tracked down the expiration appeared to not be working in a predictable
manner.

Turns out that realtime(expire) is being called twice. This results in
the following behavior:

At Start+100 seconds, an expiration time of 15 seconds:
	100 + 15 = 115, 100 + 115 = 215

At Start+1000 seconds, ...
	1000 + 15 = 1015, 1000 + 1015 = 2015... 

So basically, unless the value is set almost immediately after memcached
startup, it's expiration time will be huge compared to what was actually
requested.

This should fix it... Looks like overlapping changes in 287 combined
with 288 broke it.

Index: memcached.c
===================================================================
--- memcached.c (revision 318)
+++ memcached.c (working copy)
@@ -814,7 +814,7 @@
         }
 
         expire = realtime(expire);
-        it = item_alloc(key, flags, realtime(expire), len+2);
+        it = item_alloc(key, flags, expire, len+2);
 
         if (it == 0) {
             if (! item_size_ok(key, flags, len + 2))




 
------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul at umr.edu
University of Missouri - Rolla         Phone: (573) 341-6679
UMR Information Technology             Fax: (573) 341-4216



More information about the memcached mailing list