1.1.7 is broken

Brad Fitzpatrick brad@danga.com
Tue, 29 Jul 2003 21:44:06 -0700 (PDT)


Don't use the just-released 1.1.7.  While we tested new functionality, we
accidentally broke an important piece of old functionality.  Details
below.

I'll put in CVS and make a new release shortly.

On my whiteboard is "memcached test suite".  I guess this highlights the
importance of that project.  Maybe I'll put a star by it.  :)

While we're talking about broken:  don't use libevent-0.6 (which is in
Debian) using epoll-lt (level-triggered) on Linux.  The libevent page
warns about this, but you might accidentally assume the libevent is Debian
(even unstable) is old.  I suppose I could put binaries up, if there's any
interest.  (building an epoll kernel is easier than building libevent with
epoll support, due to header file hell)



---------- Forwarded message ----------
Date: Wed, 30 Jul 2003 07:25:56 +0200
From: Anatoly Vorobey <mellon@pobox.com>
To: Brad Fitzpatrick <brad@danga.com>
Subject: Re: memcache bug

>Things just don't store:
>Or they do, but very rarely.

yeah, when explicit exptime is given.

The below fixes the bug. There was a conflict between the usual meaning of
exptime=0 (don't expire) and the new fancy let-exptime-be-used-as-delta
stuff.

This is totally my fault. I dunno what I was thinking and how it
slipped through. Just shoot me.

main -> wcmtools          src/memcached/memcached.c
--- cvs/wcmtools/memcached/memcached.c  Tue Jul 29 21:14:55 2003
+++ src/memcached/memcached.c   Tue Jul 29 21:21:26 2003
@@ -47,14 +47,19 @@
 static int deltotal;

 time_t realtime(time_t exptime) {
-    time_t now = time(0);
+    time_t now;

     /* no. of seconds in 30 days - largest possible delta exptime */
     #define REALTIME_MAXDELTA 60*60*24*30

+    if (exptime == 0) return 0; /* 0 means never expire */
+
     if (exptime > REALTIME_MAXDELTA)
         return exptime;
-    else return exptime + now;
+    else {
+        now = time(0);
+        return exptime + now;
+    }
 }

 void stats_init(void) {

-- 
Anatoly Vorobey,
my journal (in Russian): http://www.livejournal.com/users/avva/
mellon@pobox.com http://pobox.com/~mellon/
"Angels can fly because they take themselves lightly" - G.K.Chesterton