-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Timeout for MemcacheLock #54
Comments
Morgan Fainberg () wrote: Whoops, wasn't logged in when I reported this. Tagging my name to it. If i get a chance in the next couple days I'll submit a pull request. |
Michael Bayer (zzzeek) wrote: it's easy for us to support timeout for the redis lock because we are using the lock implementation that comes with the Python redis client. If such a lock exists for memcached, that might be preferable (e.g. if there's something on pypi which is widely used and super-well-written, I'd consider it). otherwise, if submitting a pull req please try to make sure the timeout parameter is tested and does what it advertises. |
Morgan Fainberg () wrote: I have some tentative code that I'm using in a wrapper for dogpile. I'll see if I can distill it. Of course, testing in this case is super important. I will 2x check to see if we have some "lock" mechanism that makes sense to use on pypi before trying to use the more-domain specific code I've developed. |
Matthew Phipps () wrote: Morgan, did you figure this out? |
Morgan Fainberg () wrote: Finally got around to contributing the code, This is addressed in pull-request: https://bitbucket.org/zzzeek/dogpile.cache/pull-request/31/add-in-timeout-for-memcache-distributed/diff |
Michael Bayer (zzzeek) wrote: updated to pr: https://bitbucket.org/zzzeek/dogpile.cache/pull-requests/37/unit-tests-are-passing-with-the-time-in/diff |
Michael Bayer (zzzeek) wrote:
→ 2af09b2 |
Michael Bayer (zzzeek) wrote: pr is merged |
Changes by Michael Bayer (zzzeek):
|
Migrated issue, originally created by Anonymous
Similar to the REDIS backend, the Memcache backend supports distributed locking. It looks like there is no lock_timeout configurable for the distributed lock in Memcached:
https://bitbucket.org/zzzeek/dogpile.cache/src/4c19440ad41a8f36ddf6ae41618a7f3b7fb8dd32/dogpile/cache/backends/memcached.py?at=master#cl-34
Compared to redis: https://bitbucket.org/zzzeek/dogpile.cache/src/4c19440ad41a8f36ddf6ae41618a7f3b7fb8dd32/dogpile/cache/backends/redis.py?at=master#cl-106
This means that in some cases you could achieve a state with bad locking that could cause a (near) endless loop.
The text was updated successfully, but these errors were encountered: