Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

KeyError is silenced if thrown from inner handler #37

Open
lenolib opened this issue Jul 17, 2016 · 2 comments
Open

KeyError is silenced if thrown from inner handler #37

lenolib opened this issue Jul 17, 2016 · 2 comments

Comments

@lenolib
Copy link

lenolib commented Jul 17, 2016

If a KeyError is thrown in the handler, it will be caught and no log output will be produced. It bit me and it took some time to figure out what was happening.
Proposed fix: try-except-KeyError only the environ lookup.

https://github.com/kennethreitz/flask-sockets/blob/master/flask_sockets.py#L47

        except (NotFound, KeyError):
            return self.wsgi_app(environ, start_response)
@pddenhar
Copy link

@lenolib I know this is a very old issue, but thank you for pointing me in the right direction after a frustrating hour of debugging a flask-sockets application that would sometimes drop connections completely silently with no error output from Gunicorn.

The culprit was a KeyError in the socket handler, and as noted above KeyErrors are silently absorbed by the library. The solution suggestion above works for me as well.

@lenolib
Copy link
Author

lenolib commented Nov 26, 2020

@pddenhar It brings me joy that my finding was helpful to you after such a long time.

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

No branches or pull requests

2 participants