Skip to content
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

Closed
sqlalchemy-bot opened this issue Dec 16, 2013 · 9 comments
Closed

Implement Timeout for MemcacheLock #54

sqlalchemy-bot opened this issue Dec 16, 2013 · 9 comments
Labels
bug Something isn't working

Comments

@sqlalchemy-bot
Copy link

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.

@sqlalchemy-bot
Copy link
Author

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.

@sqlalchemy-bot
Copy link
Author

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.

@sqlalchemy-bot
Copy link
Author

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.

@sqlalchemy-bot
Copy link
Author

Matthew Phipps () wrote:

Morgan, did you figure this out?

@sqlalchemy-bot
Copy link
Author

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

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot
Copy link
Author

Michael Bayer (zzzeek) wrote:

2af09b2

@sqlalchemy-bot
Copy link
Author

Michael Bayer (zzzeek) wrote:

pr is merged

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added the bug Something isn't working label Nov 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant