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.

classification
Title: subprocess with preexec_fn when fork() fails could corrupt PyErr state
Type: behavior Stage: commit review
Components: Extension Modules Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: gregory.p.smith, miss-islington
Priority: normal Keywords: patch

Created on 2018-09-13 10:57 by gregory.p.smith, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9255 merged gregory.p.smith, 2018-09-13 11:03
PR 9256 merged miss-islington, 2018-09-13 11:30
PR 9292 closed gregory.p.smith, 2018-09-14 05:19
Messages (3)
msg325238 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2018-09-13 10:57
Found in the stdlib test suite while testing the fix for bpo-6721: When subprocess is called with a preexec_fn and os.register_at_fork has been used and the fork() system call fails, the Python error state is set before the "after fork in parent process" function calls that were registered were called.  So they'd call back into Python code with a pending unreturned exception set.

boom.  SystemError (or assertion failure in pydebug builds).
msg325239 - (view) Author: miss-islington (miss-islington) Date: 2018-09-13 11:30
New changeset a20b6adb5a5880fd22c099961eb9f9787739cefe by Miss Islington (bot) (Gregory P. Smith) in branch 'master':
bpo-34658: Fix rare subprocess prexec_fn fork error. (GH-9255)
https://github.com/python/cpython/commit/a20b6adb5a5880fd22c099961eb9f9787739cefe
msg325265 - (view) Author: miss-islington (miss-islington) Date: 2018-09-13 17:11
New changeset b2ff9a9f9298761985aa85aa3f42421ce6effb9e by Miss Islington (bot) in branch '3.7':
bpo-34658: Fix rare subprocess prexec_fn fork error. (GH-9255)
https://github.com/python/cpython/commit/b2ff9a9f9298761985aa85aa3f42421ce6effb9e
History
Date User Action Args
2022-04-11 14:59:05adminsetgithub: 78839
2018-09-14 05:24:27gregory.p.smithsetstatus: open -> closed
stage: patch review -> commit review
resolution: fixed
versions: - Python 3.6
2018-09-14 05:19:38gregory.p.smithsetpull_requests: + pull_request8723
2018-09-13 17:11:03miss-islingtonsetmessages: + msg325265
2018-09-13 11:30:23miss-islingtonsetpull_requests: + pull_request8688
2018-09-13 11:30:15miss-islingtonsetnosy: + miss-islington
messages: + msg325239
2018-09-13 11:04:43gregory.p.smithsetcomponents: + Extension Modules
2018-09-13 11:03:14gregory.p.smithsetkeywords: + patch
pull_requests: + pull_request8687
2018-09-13 10:57:49gregory.p.smithsettype: behavior
stage: patch review
2018-09-13 10:57:27gregory.p.smithcreate