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

uncaptured python exception repeatedly crashing server #383

Closed
ThisIsJustTemporary opened this issue Jul 3, 2022 · 1 comment · Fixed by #399
Closed

uncaptured python exception repeatedly crashing server #383

ThisIsJustTemporary opened this issue Jul 3, 2022 · 1 comment · Fixed by #399
Assignees
Labels

Comments

@ThisIsJustTemporary
Copy link

One particular user keeps submitting a request to my server that causes it to crash with an uncaptured python exception. Below is the request and corresponding error:

[2022-Jul-03 01:05] XXX.XX.XX.XXX  http /? 405 METHOD NOT ALLOWED
[2022-Jul-03 01:06] XXX.XX.XX.XXX GET http /nice ports,/Trinity.txt.bak? 404 NOT FOUND
[2022-Jul-03 01:06] XXX.XX.XX.XXX  http /? 405 METHOD NOT ALLOWED
ERROR:waitress:uncaptured python exception, closing channel <waitress.server.TcpWSGIServer listening XXX.XX.XXX.XX at XXXXXXXX> (<class 'OSError'>:[Errno 22] Invalid argument [/XXXX/XXXX/XXXX/waitress/wasyncore.py|read|104] /XXXX/XXXX/XXXX/waitress/wasyncore.py|handle_read_event|492] /XXXX/XXXX/XXXX/waitress/server.py|handle_accept|316] [/XXXX/XXXX/XXXX/waitress/server.py|set_socket_options|372])
WARNING:waitress:unhandled close event

My server is a Flask app running on a Mac OS with waitress 2.1.2. I glanced into the server.py code and it looks like an exception handler is supposed to catch this situation (at least for Linux), but it doesn't seem to be working (or more likely, I don't fully understand how it should work). The other odd thing is that the same request from the same user does not always trigger the error: sometimes the server continues even after receiving the 3 identical requests that precede the error message. I haven't yet figured out how to trigger the error myself, but it looks like the method is just an empty string (note the extra space after the IP address).

Thanks in advance!

@digitalresistor
Copy link
Member

It took me a while, but I was able to reproduce this one time, but never again. It seems to only happy when the socket that was accepted was already closed by the remote, but before we go around to setting various socket options on it. I have added #399 which will "fix" the issue by letting the server continue.

The previous log messages you see preceding the error don't apply in this case.

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

Successfully merging a pull request may close this issue.

2 participants