This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Mike Pomraning, SilentGhost, martin.panter, rpcope1, vstinner
Date 2016-04-12.16:07:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1460477274.89.0.575307619141.issue25942@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-04-12 16:07:54vstinnersetrecipients: + vstinner, SilentGhost, martin.panter, Mike Pomraning, rpcope1
2016-04-12 16:07:54vstinnersetmessageid: <1460477274.89.0.575307619141.issue25942@psf.upfronthosting.co.za>
2016-04-12 16:07:54vstinnerlinkissue25942 messages
2016-04-12 16:07:54vstinnercreate