views:

304

answers:

1

I keep running into this error MemCacheError (Broken pipe): Broken pipe on my Rails app and I can't figure out why.

When I access memcached via Rails.cache in my controller, the first 1 or 2 read/writes always seems to throw the broken pipe error. But when I access memcached by creating a new object, ActiveSupport::Cache::MemCacheStore.new, I don't seem to get this error.

I also access memcached in another ruby process, and the first read always has this error regardless of the way I access memcached. I did implement a work around just by retrying the read but id rather have a better long term solution.

Currently the only time I see this problem is after I restart memcached. I'm using Rails 2.3.5 and memcached 1.4.4 (I've also tried this with memcached 1.2.2).

+1  A: 

I believe this error occurs when you restart memcached while the rails app is still running. If you restart mongrel or the rails app in passenger after you restart memcached, you shouldn't see this problem.

AdamB