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
When WSGIRequestHandler catches socket.error it silences all other OSErrors in Python 3 #1127
Comments
I feel like we had this before. I thought we fixed this somewhere already. |
It was reported against Flask and we discussed it there, but it's a bug against Werkzeug so I moved it here. Maybe that's what you're remembering? pallets/flask#1995 |
Can I work on this? If so, any suggestion/advice to begin with that consideration? |
@aaossa I'm not sure what you mean with "that consideration". One possible approach to this issue is described in the OP |
With "that consideration" I meant the suggestion/advice I was asking for. I'll give it a try. |
I have a possible solution here, should I create a test? @untitaker |
I haven't looked at this in a while, but |
I though that the problem was using EDIT: I tried the example from the original issue and worked without problems, but I haven't tested with a "pure" |
|
That's what I said at the top. Also, you're using really old syntax for catching errors there. |
Reported at pallets/flask#1995.
WSGIRequestHander.run_wsgi
catchessocket.error
to silence client disconnects. In Python 2 this was fine, becausesocket.error
was unique. In Python 3,socket.error is OSError
, so anyOSError
or subclass (IOError
, etc.) is also silenced.Possible solution is to check if
e.errno
is a disconnect-related error and bubble the error up otherwise. Or catch a more specific error such asConnectionError
in Python 3.This only affects Werkzeug's dev server, other WSGI servers like Gunicorn do not exhibit this behavior.
The text was updated successfully, but these errors were encountered: