nkallen / cache-money

A Write-Through Cacheing Library for ActiveRecord
Apache License 2.0
994 stars 107 forks source link

Cash::Lock::Error #6

Open dkindlund opened 15 years ago

dkindlund commented 15 years ago

Hi Nick, Occasionally, I get the following "Cash::Lock::Error" and was wondering if you could shed some light as to whether cache-money or memcached generated the underlying issue:

... /var/lib/gems/1.8/gems/memcached-0.14/lib/memcached/memcached.rb:389:in `check_return_code': Key {"lock/Url:7/client_id/19799"=>"172.16.164.42:11211:8"} Cash::Lock::Error

If it's an error that's ultimately generated by memcached, I assume there's no way to fix it at any other level (e.g., in rails). Is that a fair assessment?

Thanks, -- Darien

ngmoco commented 14 years ago

This error is caused when cache-money cannot get add a lock value to memcache. Cache-money tries a '@cache.add("lock/#{key}", Process.pid, lock_expiry)'. If this fails it waits for a period of time (which increases with each retry) then retries. It repeats for a default of 5 times.

We did not see this error until our production system was under load, not the best time to see this error, and then it occurs a lot.

If you have any ideas WRT fixing this error let us know.