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

pylibmc is not thread-safe #113

Closed
cedk opened this issue May 10, 2019 · 7 comments
Closed

pylibmc is not thread-safe #113

cedk opened this issue May 10, 2019 · 7 comments
Labels

Comments

@cedk
Copy link

cedk commented May 10, 2019

The way pylibmc client is used is not thread-safe.
I think flask-caching should use the ThreadMappedPool.
Otherwise on threaded Flask application, we must use python-memcached but there is no way to force to use this library.

@reubano
Copy link

reubano commented Aug 18, 2019

I think I've run into this issue. While running on heroku, not all instances of the cache respect CACHE_DEFAULT_TIMEOUT. It took me ages to figure out why my cache was clearing after 5 minutes, despite having set CACHE_DEFAULT_TIMEOUT for longer.

@reubano
Copy link

reubano commented Aug 20, 2019

I'm using python-binary-memcached>=0.26.1,<0.27.0

@sh4nks
Copy link
Collaborator

sh4nks commented Nov 24, 2019

Actually this is not a bug. If you need a threadsafe memcache backend, you can just subclass the existing one and add it there. The reason I am not adding it is as due to the fact that the ThreadMappedPool is only supported by pylibmc and we are supporting 4 different memcache libraries.

@sh4nks sh4nks closed this as completed Nov 24, 2019
@cedk
Copy link
Author

cedk commented Nov 24, 2019

Then maybe pylibmc should not be the first library to use as its client is not thread safe by default.

@sh4nks
Copy link
Collaborator

sh4nks commented Nov 24, 2019

Yeah maybe. I am happy to review a PR if you want to submit one :-)

@reubano
Copy link

reubano commented Nov 24, 2019

@cedk can you outline the steps you took to get thread safe behavior with python-memcached?

@sh4nks sh4nks reopened this Nov 24, 2019
@sh4nks sh4nks removed this from the 1.8.0 milestone Nov 24, 2019
@sh4nks
Copy link
Collaborator

sh4nks commented May 31, 2020

I am closing this issue for now. As I have said before, I'd happily review a PR if someone wants to implement this.

@sh4nks sh4nks closed this as completed May 31, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants