Bug 55445 - mod_socache_memcache ignores expiry, creating eternal memcache entries
Summary: mod_socache_memcache ignores expiry, creating eternal memcache entries
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_socache_(dbm|dc|memcache|shmcb) (show other bugs)
Version: 2.4-HEAD
Hardware: All All
: P2 major with 3 votes (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2013-08-18 11:41 UTC by Gil Bahat
Modified: 2017-11-01 17:36 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gil Bahat 2013-08-18 11:41:23 UTC
(see also http://apache-http-server.18135.x6.nabble.com/PATCH-mod-socache-memcache-don-t-ignore-expiry-td5007649.html)

socache_memcache ignores shared object expiry settings, creating keys which are never cleared from the memcache daemon.

there is a one-line patch and further discussion at the above URL, reposted for convenience:

--- modules/cache/mod_socache_memcache.c	(revision 1510425) 
+++ modules/cache/mod_socache_memcache.c	(working copy) 
@@ -205,9 +205,10 @@ 
         return APR_EINVAL; 
     } 
  
-    /* In APR-util - unclear what 'timeout' is, as it was not implemented */ 
-    rv = apr_memcache_set(ctx->mc, buf, (char*)ucaData, nData, 0, 0); 
+    rv = apr_memcache_set(ctx->mc, buf, (char*)ucaData, nData, 
+                          apr_time_sec(expiry), 0); 
  
+ 
     if (rv != APR_SUCCESS) { 
         ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, APLOGNO(00790) 
                      "scache_mc: error setting key '%s' " 

I have tested this patch myself and it does indeed cause the correct values to be sent to the server.
Comment 1 Faidon Liambotis 2013-08-31 12:37:16 UTC
That was me, thanks for forwarding the patch. I'm adding myself to Cc, in case there are any questions.
Comment 2 Matt Jamison 2014-12-20 06:37:47 UTC
I realize this post is quite old, but I ran into this same bug today and it looks from everything I see like this patch was never taken to correct it?  Perhaps I'm missing something, but this module is not as useable as it could be without the patch provided, since cache entries cannot be expired?

Should this patch be merged or is there some other fix available?
Comment 3 Gil Bahat 2014-12-21 13:41:46 UTC
someone just needs to commit the thing - I have no idea how things get done here in the apache project... I just added the patch that someone else already did for this little bug. FWIW I am also very keen on seeing this fixed myself, but I sure as hell can't commit it.
Comment 4 Matt Jamison 2015-01-06 20:35:39 UTC
Strange, I'm going to tweak some things in the bug just to see if it'll get someone's attention.  Hopefully we can at least get a pointer on how to get this committed...
Comment 5 Eric Covener 2015-01-06 20:38:08 UTC
fixed in trunk http://svn.apache.org/r1649491
Comment 6 Christophe JAILLET 2017-11-01 17:36:39 UTC
Backported in r1772331 and part of version 2.4.24