pycapnp icon indicating copy to clipboard operation
pycapnp copied to clipboard

Unable to shutdown server

Open brennerm opened this issue 9 years ago • 3 comments

Currently I see no way to gently shutdown the server. It always ends in killing the process. Could we implement something to solve this?

brennerm avatar Apr 29 '15 07:04 brennerm

This is definitely a big problem, but I'm not sure how best to solve it. Solutions that I can think of:

  1. Make modifications to the event loop to check for signals with PyErr_CheckSignals periodically
  2. 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).
  3. 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.

jparyani avatar Apr 30 '15 05:04 jparyani

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.

brennerm avatar Apr 30 '15 11:04 brennerm

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)

Cheaterman avatar Mar 10 '20 13:03 Cheaterman