-
-
Notifications
You must be signed in to change notification settings - Fork 720
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
Is it intended that any error from a handler makes Server.handle_stream
close the comm?
#5483
Comments
Server.handle_stream
suppress exceptions from handlers?Server.handle_stream
close the comm?
Long known problem. While trying to fix this I ran into a bazillion other smaller inconsistencies and that escalated into an unmergable PR, see #4734. Also very interesting in this space is #5443
I believe closing the stream is a radical but safe way to deal with this. I'm not sure how else you'd like to handle that exception since you do not know what the exception is and therefore cannot implement a clean exception handler. However, what's even more important than whether or not we close the stream is how the reraised exception is handled since the handle_stream is always wrapped distributed/distributed/worker.py Lines 1236 to 1248 in 11c41b5
distributed/distributed/scheduler.py Lines 5296 to 5300 in 11c41b5
distributed/distributed/scheduler.py Lines 5510 to 5515 in 11c41b5
What they all have in common is that they retrigger a removal of the involved server which in turn may reconnect. I would argue the stream handling is fine. If any problems pop up, that's related to the reconnects. |
In #5480, an unexpected error (#5482) in a stream handler caused the entire stream to close. It turns out we didn't properly reconnect when the worker<->scheduler stream closed (#5481), so things got into a broken state and deadlocked.
I'm curious though if it makes sense for
handle_stream
to close the whole stream in this case though. You can see here that there are a couple unhandled error cases that would cause the comm to close:distributed/distributed/core.py
Lines 559 to 564 in 11c41b5
stream_handlers[op]
does not exist (message requesting an invalid op).handler(**merge(extra, msg))
raises an error (what happened here).handler
is async, the stream will stay open even ifhandler
fails whenever it runs in the future. Why the inconsistency with synchronous?I'm not quite sure what the protocol is meant to be here. Is closing the comm the only way we have to tell the sender that something went wrong, so we're using it as a signal? Or do we believe that after any failure, we can't trust subsequent messages to be valid, so we should give up and wait to restart the connection if desired?
The text was updated successfully, but these errors were encountered: