[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Nathaniel Smith
Nathaniel Smith added the comment: It might be possible to create ProcessPoolExecutor and get it to spawn all the workers *before* you start the asyncio loop. It looks like ProcessPoolExecutor delays spawning workers until the first piece of work is submitted, but at that

[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: You may switch to multiprocessing.Pool (with the "forkserver" method). Otherwise, you could workaround it by executing a function on all workers that will reset the signal configuration. To maximize the chances that it does get executed on

[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Ilya Kulakov
Ilya Kulakov added the comment: Can you suggest an alternative to ProcessPoolExecutor for 3.6? -- ___ Python tracker ___

[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Nathaniel Smith
Nathaniel Smith added the comment: Ouch, yes, that's a tricky bug. This is definitely caused by the way that asyncio internally converts signals into messages along a pipe (well, socket, but same thing), and then after a fork-without-exec the child keeps writing into that

[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-12-19 Thread Antoine Pitrou
Antoine Pitrou added the comment: I get the feeling (without actually investigating) that this is because a fork()-created process inherits all the parent's configuration, including (in this case) signal handlers and whatever file descriptor was configured to receive signal

[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-09-15 Thread Ilya Kulakov
Ilya Kulakov added the comment: I think either loop's signal handler should not be called from a subprocess or at the very least, os.getpid / os.getpgrp should report correctly. -- ___ Python tracker

[issue31489] Signal delivered to a subprocess triggers parent's handler

2017-09-15 Thread Ilya Kulakov
New submission from Ilya Kulakov: It looks like a signal delivered to multiprocessing's process implicitly created by ProcessPoolExecutor triggers signal handler in the parent: ``` from concurrent.futures import ProcessPoolExecutor import asyncio import os import signal import sys import time