pycapnp
pycapnp copied to clipboard
Unable to shutdown server
Currently I see no way to gently shutdown the server. It always ends in killing the process. Could we implement something to solve this?
This is definitely a big problem, but I'm not sure how best to solve it. Solutions that I can think of:
- Make modifications to the event loop to check for signals with
PyErr_CheckSignals
periodically - Register our own signal handler in C++ that somehow kills the event loop (I'm not sure how to do this beyond a non-clean exit).
- We can re-use
sig_on/sig_off
from Sage (https://github.com/sagemath/sage/blob/f0f7b3a1b3b68688610cef5d131ae696f3034c7b/src/c_lib/include/interrupt.h). This seems easier but may be unsafe.
Unfortunately I don't know the source code good enough to assist you with this question right now. I'm gonna have a look in the next time.
Hey @haata I hope you're doing good :-) do you think it would be possible to fix this for non-async mode? (Assuming it already works in async mode, didn't try)