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

pymemcache fails if resolving the memcached server fails #318

Open
yakirsudry opened this issue May 16, 2021 · 5 comments
Open

pymemcache fails if resolving the memcached server fails #318

yakirsudry opened this issue May 16, 2021 · 5 comments

Comments

@yakirsudry
Copy link

Sometime my memcached server is down.
When that happens, resolving its address fails on the following line:

info = s.getaddrinfo(host, port, s.AF_UNSPEC, s.SOCK_STREAM,
                                 s.IPPROTO_TCP)

This crashes pymemcache.
What should actually happen is to assume it is down, and just marking that as "missed"

I understand that I can use ignore_exc, but this seems like a much more local thing.

@jogo
Copy link
Contributor

jogo commented May 20, 2021

Changing this default behavior now is a backwards incompatible change, so we need to be careful about this one. Can you elaborate on why you don't think ignore_exc is adequate here? Are you asking for the ability to only treat s.getaddrinfo failing as a miss and not other errors?

@yakirsudry
Copy link
Author

ignore_exc indeed handles the problem correctly.

But having the server down or unreachable doesn't feel like an "exception". I feel like this specific case should be treated as a simple miss.

I agree that it's not obvious and I'm not sure if everyone will agree with me

@jogo
Copy link
Contributor

jogo commented May 20, 2021

There are many use cases where someone would like to monitor if their application isn't able to communicate to memcache instead of silently ignoring it, and treating it like a miss by default can easily mask critical issues.

ignore_exc is already documented in the getting started guide so hopefully that makes it easy for users to choose which behavior they prefer.
https://pymemcache.readthedocs.io/en/latest/getting_started.html#best-practices

@jparise
Copy link
Collaborator

jparise commented Jun 16, 2021

#307 has some related discussion.

@jogo
Copy link
Contributor

jogo commented May 31, 2022

@yakirsudry do you have any suggestions on what we can do in while ensuring backwards compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants