STINNER Victor added the comment:

Again, the problem is that the exception exits from the function which owns the 
last reference to the Popen object. If the Popen is left alive when you exit 
the function, you create a zombi process, you can leave open pipes, etc.

It's unclear to me if CTRL+c sends SIGTERM to all processes or only a few of 
them (only the parent process?). Even if SIGTERM is sent to all processes, a 
child process can decide to completly ignore it, or can block in a deadlock or 
whatever.

Giving a few seconds to the child process to wait until it ends is not easy 
because it's hard to choose an arbitrary timeout. If the timeout is too low, 
you kill the child process (SIGKILL) before it flushes files. If the timeout is 
too long, the parent process is blocked too long when the child process is 
really blocked.

I suggest to keep the current behaviour by default.

If you really want to give time to the child process, I suggest to add a *new* 
optional parameter . For example ctrlc_timeout=5.0 to send SIGTERM and then 
wait 5 seconds.

I don't know if the parent process must always send a SIGTERM to the child 
process or not. One signal or two don't have the same behaviour. It's possible 
to explicitly send a SIGTERM to only one process using the kill command.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25942>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to