[New-bugs-announce] [issue25942] subprocess.call SIGKILLs too liberally

Mike Pomraning report at bugs.python.org
Thu Dec 24 20:15:08 EST 2015


New submission from Mike Pomraning:

Python 3.3 introduces timeout support in subprocess.call, implemented by sending a SIGKILL if the Popen.wait is interrupted by a TimeoutExpired exception.

However, the "except" clause is too broad, and will, for instance, trigger on a KeyboardInterrupt.  For practical purposes, this means that sending a Ctrl-C to a python program before 3.3 sent a SIGINT to both the parent and subprocess.call()d child, whereas under 3.3+ sends a SIGINT _and_ a SIGKILL to the child.  The child will not be able to clean up appropriately.

For a real world example of this, see http://stackoverflow.com/q/34458583/132382

The fix is, I think, simply changing the clause to "except TimeoutExpired".  At least, that works for me.  See attached patch.

----------
components: Library (Lib)
files: subprocess-call-py344-kill-only-on-timeout.patch
keywords: patch
messages: 256973
nosy: Mike Pomraning
priority: normal
severity: normal
status: open
title: subprocess.call SIGKILLs too liberally
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file41407/subprocess-call-py344-kill-only-on-timeout.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25942>
_______________________________________


More information about the New-bugs-announce mailing list