Conversation
|
Keyboard interrupt is an unfortunately complicated and nuanced problem. I think I'd prefer to see this handled using signal handlers to (IMO) ignore keyboard interrupt in the child processes (or at the very least in PoolWorker), and then allow the parent process to catch and gracefully request the child processes be terminated. Eg, for process pools, if the parent process defines a keyboard interrupt handler to gracefully stop their process, the last thing they would want is the child processes to terminate all pending work and abort immediately. As-is, this behavior just causes the parent process to hang forever waiting for results that the child processes will never deliver because they aborted. If you don't have the time to rework this, I have an idea of how I'd like to handle it, and can probably put that together soon. |
Description
Code to replicate issue:
(run and press Ctrl+C)
You will see a lot of stack traces like:
This PR is supposed to solve this problem.