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.

Title: All sub-processes spawned from Python have their execution semantics altered
Type: behavior Stage:
Components: Interpreter Core Versions: Python 2.6
Status: closed Resolution: duplicate
Dependencies: Superseder: subprocess should have an option to restore SIGPIPE to default action
View: 1652
Assigned To: Nosy List: pitrou, tholzer
Priority: normal Keywords:

Created on 2010-02-15 01:28 by tholzer, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg99352 - (view) Author: (tholzer) Date: 2010-02-15 01:28
When a sub-process is spawned from Python (e.g. subprocess.Popen, os.system, etc.), the execution semantics are altered by the Python interpreter as it ignores SIGPIPE which gets inherited by all children.

This causes hung processes, CPU spins and various other altered execution semantics for all sub-processes spawned from Python.

The following example will end up spinning the CPU at 100% whereas the expected behaviour is that it would print a single line of random numbers and exit.

python -c 'import subprocess; p = subprocess.Popen("hexdump /dev/urandom | head -n 1", shell=True); print "a %s %s" % (p.communicate());'
msg99358 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-02-15 10:42
This is a duplicate of issue1652.
Date User Action Args
2022-04-11 14:56:57adminsetgithub: 52181
2010-02-15 10:42:59pitrousetstatus: open -> closed

nosy: + pitrou
messages: + msg99358

superseder: subprocess should have an option to restore SIGPIPE to default action
resolution: duplicate
2010-02-15 01:28:51tholzercreate