git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Random signal capture when using multiprocessing


On Sat, Jul 06, 2019 at 04:54:42PM +1000, Chris Angelico wrote:

> But if I comment out the signal.signal line, there seem to be no ill
> effects. I suspect that what you're seeing here is the multiprocessing
> module managing its own subprocesses, telling some of them to shut
> down. I added a print call to multiprocessing/popen_fork.py inside
> _send_signal (line 53 or thereabouts depending on Python version) and
> saw a *lot* of termination signals being sent; only a few actually
> triggered the exception message. My guess is that most of the time,
> the SIGTERM is smoothly handled as part of the Pool's __exit__ method,
> but sometimes the child process is blocked on something, and has to
> be told to shut down; and then normally, the signal gets caught and
> handled just fine, but since you're explicitly hooking it, you get to
> see it.

Ok, that makes all the sense in the world, thanks for digging into this.

-- 
Jos? Mar?a (Chema) Mateos || https://rinzewind.org/