Issue 15756: subprocess.poll() does not handle errno.ECHILD "No child processes" (original) (raw)
Issue15756
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.
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/59960
classification
Title: | subprocess.poll() does not handle errno.ECHILD "No child processes" | ||
---|---|---|---|
Type: | behavior | Stage: | |
Components: | Library (Lib) | Versions: | Python 3.2, Python 3.3, Python 3.4, Python 2.7 |
process
Status: | closed | Resolution: | fixed |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | gregory.p.smith | Nosy List: | gregory.p.smith, jcea, python-dev, tshepang, twhitema |
Priority: | normal | Keywords: | patch |
Created on 2012-08-21 19:15 by twhitema, last changed 2022-04-11 14:57 by admin. This issue is now closed.
Files | |||
---|---|---|---|
File name | Uploaded | Description | Edit |
issue15756_poll_v1.patch | twhitema,2012-08-21 19:20 | review |
Messages (5) | ||
---|---|---|
msg168798 - (view) | Author: Todd Whiteman (twhitema) | Date: 2012-08-21 19:15 |
In the case of a "errno.ECHILD" exception - Python's subprocess module misses the fact that the process has already ended. The following code will wait indefinitely, even though the launched process is quickly ended: import subprocess, signal signal.signal(signal.SIGCLD, signal.SIG_IGN) p = subprocess.Popen(['echo','foo']) while p.poll() is None: pass # wait for the process to exit Note: This is the exact same issue as , but applying to the subprocess.poll() method instead of the subprocess.wait() method. | ||
msg168799 - (view) | Author: Todd Whiteman (twhitema) | Date: 2012-08-21 19:20 |
The attached patch handles errno.ECHILD in the _internal_poll() method and I've updated the existing "sigchild_ignore.py" test file to perform polling as well. An unpatched version of Pyhton would normally hang on this particular test, whilst the patched version will run successfully. | ||
msg169581 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2012-08-31 20:38 |
thanks! I'll take care of getting this fix in. | ||
msg171588 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2012-09-29 18:58 |
New changeset 484c50bf445c by Gregory P. Smith in branch '3.2': Fixes issue #15756: subprocess.poll() now properly handles errno.ECHILD http://hg.python.org/cpython/rev/484c50bf445c New changeset ba8d85552e34 by Gregory P. Smith in branch '3.3': Fixes issue #15756: subprocess.poll() now properly handles errno.ECHILD http://hg.python.org/cpython/rev/ba8d85552e34 New changeset 9032b3f52819 by Gregory P. Smith in branch 'default': Fixes issue #15756: subprocess.poll() now properly handles errno.ECHILD to http://hg.python.org/cpython/rev/9032b3f52819 | ||
msg171589 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2012-09-29 19:03 |
New changeset 53e91fa35f8e by Gregory P. Smith in branch '2.7': Issue #15756: subprocess.poll() now properly handles errno.ECHILD to http://hg.python.org/cpython/rev/53e91fa35f8e |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:57:35 | admin | set | github: 59960 |
2012-09-29 19:03:53 | gregory.p.smith | set | status: open -> closedresolution: fixed |
2012-09-29 19:03:25 | python-dev | set | messages: + |
2012-09-29 18:58:44 | python-dev | set | nosy: + python-devmessages: + |
2012-09-10 02:12:51 | jcea | set | nosy: + jcea |
2012-08-31 20:38:34 | gregory.p.smith | set | assignee: gregory.p.smithmessages: + |
2012-08-31 19:31:00 | berker.peksag | set | versions: - Python 2.6, Python 3.1 |
2012-08-25 08:49:05 | tshepang | set | nosy: + tshepang |
2012-08-21 19:20:36 | twhitema | set | files: + issue15756_poll_v1.patchkeywords: + patchmessages: + |
2012-08-21 19:15:33 | twhitema | set | nosy: + gregory.p.smith |
2012-08-21 19:15:17 | twhitema | create |