You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If aiozmp RPC server is terminated with KeyboardInterrupt (e.g. ctrl+c), there is inexplicable mess of asyncio.CancelledError being logged for every pending remote request - instead of replying back to the caller with a serialized exception, like it is the case for any other exception being raised (and then exiting cleanly). This happens because you only catch Exception, but KeyboardInterrupt does not inherit from it.
KeyboardInterrupt should be caught here, in addition to Exception:
I think you can scratch the above. On a more careful examination, what seems to be missing is catching CancelledError within try_log. As of Python 3.8, CancelledError extends from BaseException and not Exception (discussion) so it is never caught by except Exception. If you catch that and return, there is just one KeyboardInterrupt logged which is what we want.
The only thing I can't figure out is whether it's actually possible to reply to remote callers? It appears that the transport is closed by that point and I get warnings like WARNING: write to closed ZMQ socket., and then exceptions, if I try to send a reply. I guess I'll have to settle for leaving the caller hanging...
nirvana-msu
changed the title
KeyboardInterrupt should be caught in "process_call_result" and "try_log"
asyncio.CancelledError should be caught in "try_log"
Oct 2, 2021
Ifaiozmp
RPC server is terminated withKeyboardInterrupt
(e.g. ctrl+c), there is inexplicable mess ofasyncio.CancelledError
being logged for every pending remote request - instead of replying back to the caller with a serialized exception, like it is the case for any other exception being raised (and then exiting cleanly). This happens because you only catchException
, butKeyboardInterrupt
does not inherit from it.KeyboardInterrupt
should be caught here, in addition toException
:aiozmq/aiozmq/rpc/rpc.py
Line 341 in 1cde8c6
and also here:aiozmq/aiozmq/rpc/base.py
Line 243 in 1cde8c6
You'd need to reply to caller (same as on other exceptions) and then re-raise or somehow exit cleanly.The text was updated successfully, but these errors were encountered: