Random signal capture when using multiprocessing

dieter dieter at handshake.de
Sat Jul 6 01:33:42 EDT 2019


José María Mateos <chema at rinzewind.org> writes:
> This is a minimal proof of concept for something that has been bugging me for a few days:
> ....
> So basically I have some subprocesses that don't do anything, just sleep for a few milliseconds, and I capture SIGTERM signals. I don't expect 
> ...
> Running round 6 with 359 jobs
> Process ForkPoolWorker-48:
> Traceback (most recent call last):
> ...
>   File "signal_multiprocessing_poc.py", line 7, in signal_handler
>     raise Exception(f"Unexpected signal {signum}!")
> Exception: Unexpected signal 15!
> ...

"multiprocessing.util" may register an exit function which calls
"terminate" which signals SIGTERM. There is also an "os.kill(..., SIGTERM)"
in "multiprocessing.popen_fork".

I would put some print at those places to determine if the SIGTERM
comes from "multiprocessing".




More information about the Python-list mailing list