Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActiveSupport::Cache::MemCacheStore connection to MemCached becomes corrupted with invalid :expires_in

#2854

If the following code is run the first write succeeds, but the last two calls output an error in the logs:

Cache write: foo
Cache read: foo
Cache write: mynewfoo ({:expires_in=>"Mon Jun 29 13:10:40 -0700 2009"})
MemCacheError ():
Cache read: foo
MemCacheError ():

The invalid expires_in corrupts the connection to MemCache. The simplest fix to this would be to call reset on the connection to memcache and retrieve a new connection if a MemCache exception is rescued.


cache = ActiveSupport::Cache::MemCacheStore.new("localhost:11211")

cache.write("foo", "bar")

puts cache.read("foo").inspect # outputs foo

cache.write("mynewfoo", "blah", :expires_in => 'Mon Jun 29 13:10:40 -0700 2009')

puts cache.read("foo").inspect # outputs nil

Reported by ekolve · June 29th, 2009 @ 09:21 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none