URGENT: Memcache client returning unexpected results from @pool.add when using rack
oreoshake opened this issue · 4 comments
We were getting session collisions and we couldn't figure out why so we added a ton of logging. It turns out that a call to add is returning "end".
AFAIK, that should never be returned on an add operation. We expected STORED/NOT_STORED, but got END which is throwing a session collision exception within rack.
https://github.com/rack/rack/blob/master/lib/rack/session/memcache.rb
It is in the get_session method which expects STORED and errors out on anything else.
So:
- Is rack's logic flawed where END is acceptable?
- Is memcache-client flawed and returning END unexpectedly
- Is memcache itself borked?
Please note: I'm not providing support for memcache-client anymore as of Dec 2010. Please upgrade to Dalli when you have the chance.
END is part of the get_multi response. Sounds like there is a problem with session operations seeing part of the get_multi response.
I'd guess you are using the same MemCache instance for caching objects as you are for caching sessions. I'd recommend you split them into two separate instances. The session store never uses get_multi afaik. By using two instances, you should avoid this issue.
Thanks, we will move to Dalli. Just to be clear, did you mean a separate instance of memcache or a separate namespace. I'm thinking the latter?
Separate instance. Sometimes people use crap like this:
CACHE = MemCache.new
config.cache_store = :mem_cache_store, CACHE
config.session_store :mem_cache_store, { :memcache_server => CACHE }
Just make sure you aren't sharing an instance like that because it sounds like you might be.
Turns out we weren't using memcache for our cache_store, we were using
memory store
On 7/28/11 1:57 PM, mperham wrote:
Separate instance. Sometimes people use crap like this:
CACHE = MemCache.new config.cache_store = :mem_cache_store, CACHE config.session_store :mem_cache_store, { :memcache_server => CACHE }
Just make sure you aren't sharing an instance like that because it sounds like you might be.