Issue34651
Created on 2018-09-12 21:04 by eric.snow, last changed 2019-11-15 21:37 by miss-islington. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 9279 | merged | eric.snow, 2018-09-13 19:21 | |
| PR 17123 | merged | python-dev, 2019-11-12 14:44 | |
| PR 17179 | merged | miss-islington, 2019-11-15 21:30 | |
| Messages (12) | |||
|---|---|---|---|
| msg325181 - (view) | Author: Eric Snow (eric.snow) * | Date: 2018-09-12 21:04 | |
os.fork() potentially has some problematic behavior when called from a subinterpreter. In additional to the normal fork+threads madness, there's the question of what to do with existing subinterpreters. The simplest solution is to simply disallow fork in a subinterpreter and then wipe out all subinterpreters in the child process post-fork (if os.fork() called in the main interpreter). |
|||
| msg325302 - (view) | Author: Gregory P. Smith (gregory.p.smith) * | Date: 2018-09-13 23:05 | |
+1 agreed. this is the simplest approach to start with. Code to restrict: os.fork itself and disallowing the use of preexec_fn on subprocess within subinterpreters. feel free to ignore preexec_fn in subprocess for the time being if desired, we already promise people that it is a bad idea legacy API that we don't want, guaranteed to cause undiagnosable problems and deadlocks at times. :) |
|||
| msg325400 - (view) | Author: Eric Snow (eric.snow) * | Date: 2018-09-14 21:17 | |
New changeset 5903296045b586b9cd1fce0b1e02caf896028d1d by Eric Snow in branch 'master': bpo-34651: Only allow the main interpreter to fork. (gh-9279) https://github.com/python/cpython/commit/5903296045b586b9cd1fce0b1e02caf896028d1d |
|||
| msg343364 - (view) | Author: Miro Hrončok (hroncok) * | Date: 2019-05-24 10:28 | |
It appears that as a result of this, subprocess.Popen cannot be called from within a subinterpreter either. Is that an obvious and desired limitation? |
|||
| msg343369 - (view) | Author: STINNER Victor (vstinner) * | Date: 2019-05-24 10:52 | |
I reopen the issue to let Eric answer ;-) If the behavior is deliberate, maybe it should just be documented somewhere? |
|||
| msg343415 - (view) | Author: Gregory P. Smith (gregory.p.smith) * | Date: 2019-05-24 17:48 | |
I'd start by documenting the limitation and keeping a future feature request of "Allow subprocess to work from subinterpreters". That is doable. Supporting os.fork() is not. |
|||
| msg343421 - (view) | Author: STINNER Victor (vstinner) * | Date: 2019-05-24 19:25 | |
> I'd start by documenting the limitation and keeping a future feature request of "Allow subprocess to work from subinterpreters". That is doable. Supporting os.fork() is not. subprocess is able to use os.posix_spawn() in Python 3.8. In that case, it's not limited by os.fork() check ;-) Windows isn't limited neither, CreateProcess() isn't limited in subinterpreters. |
|||
| msg345599 - (view) | Author: Eric Snow (eric.snow) * | Date: 2019-06-14 15:49 | |
FYI, I plan on looking into this either today or next Friday. |
|||
| msg345603 - (view) | Author: STINNER Victor (vstinner) * | Date: 2019-06-14 16:01 | |
See also bpo-37266: "Daemon threads must be forbidden in subinterpreters". |
|||
| msg350652 - (view) | Author: Miro Hrončok (hroncok) * | Date: 2019-08-28 04:34 | |
The problem with subprocess.Popen has been fixed in https://bugs.python.org/issue37951 |
|||
| msg356694 - (view) | Author: miss-islington (miss-islington) | Date: 2019-11-15 16:56 | |
New changeset b22030073b9327a3aeccb69507694bce078192aa by Miss Islington (bot) (Phil Connell) in branch 'master': bpo-38778: Document that os.fork is not allowed in subinterpreters (GH-17123) https://github.com/python/cpython/commit/b22030073b9327a3aeccb69507694bce078192aa |
|||
| msg356720 - (view) | Author: miss-islington (miss-islington) | Date: 2019-11-15 21:37 | |
New changeset a4be5aae6e587f5310f1fc0d66d37e032621ce39 by Miss Islington (bot) in branch '3.8': bpo-38778: Document that os.fork is not allowed in subinterpreters (GH-17123) https://github.com/python/cpython/commit/a4be5aae6e587f5310f1fc0d66d37e032621ce39 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-11-15 21:37:30 | miss-islington | set | messages: + msg356720 |
| 2019-11-15 21:30:47 | miss-islington | set | pull_requests: + pull_request16688 |
| 2019-11-15 16:56:12 | miss-islington | set | nosy:
+ miss-islington messages: + msg356694 |
| 2019-11-12 14:44:18 | python-dev | set | pull_requests: + pull_request16630 |
| 2019-08-29 16:38:15 | vstinner | set | status: open -> closed resolution: fixed |
| 2019-08-28 04:34:40 | hroncok | set | messages: + msg350652 |
| 2019-06-14 16:01:52 | vstinner | set | messages: + msg345603 |
| 2019-06-14 15:49:42 | eric.snow | set | messages: + msg345599 |
| 2019-05-24 19:25:25 | vstinner | set | messages: + msg343421 |
| 2019-05-24 17:48:04 | gregory.p.smith | set | messages: + msg343415 |
| 2019-05-24 10:52:31 | vstinner | set | status: closed -> open nosy:
+ vstinner resolution: fixed -> (no value) |
| 2019-05-24 10:28:45 | hroncok | set | nosy:
+ hroncok messages: + msg343364 |
| 2018-09-14 21:18:10 | eric.snow | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-09-14 21:17:31 | eric.snow | set | messages: + msg325400 |
| 2018-09-13 23:05:46 | gregory.p.smith | set | messages: + msg325302 |
| 2018-09-13 19:21:43 | eric.snow | set | keywords:
+ patch stage: needs patch -> patch review pull_requests: + pull_request8710 |
| 2018-09-12 21:04:23 | eric.snow | create | |