Bug 1745894

Summary: subprocess module fails under mod_wsgi: fork not supported for subinterpreters
Product: [Fedora] Fedora Reporter: Christian Heimes <cheimes>
Component: python3Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, dmalcolm, jpazdziora, m.cyprian, mhroncok, pviktori, rkuska, shcherbina.iryna, slavek.kabrda, tomspur, torsava, vstinner
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python3-3.8.0~b4-1.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-09-02 07:56:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1706238, 1745450    

Description Christian Heimes 2019-08-27 07:32:04 UTC
Description of problem:
Python 3.8 started to prohibit fork() calls in subinterpreters (see bpo-34651). This also affects subprocess.Popen() calls. Only under some cases subprocess.Popen() uses posix_spawn() instead of fork() + exec(). The new restriction breaks software that executes external commands from a subinterpreter like mod_wsgi applications.

For example FreeIPA server is affected by the regression. It's no longer possible to install FreeIPA on Fedora rawhide.

Version-Release number of selected component (if applicable):
Python 3.8b3

How reproducible:
always

Steps to Reproduce:
1. Execute a subprocess under mod_wsgi (e.g. ipa-server-install)

Actual results:
...
  File "/usr/lib64/python3.8/subprocess.py", line 829, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib64/python3.8/subprocess.py", line 1608, in _execute_child
    self.pid = _posixsubprocess.fork_exec(
RuntimeError: fork not supported for subinterpreters

Expected results:
No error

Additional info:
https://bugs.python.org/issue37951

Comment 1 Christian Heimes 2019-08-27 08:17:00 UTC
Upstream PR https://github.com/python/cpython/pull/15544

Comment 2 Christian Heimes 2019-08-27 21:59:20 UTC
Fix has landed in upstream's 3.8 branch, https://github.com/python/cpython/commit/03c52f2f63a8abeb4afb75e9da46c7d6c0a8afd5

Please apply the fix to 3.8 package on rawhide.

Comment 3 Miro Hrončok 2019-08-28 04:33:54 UTC
Thanks Christian. I've been trying to say this in https://bugs.python.org/issue34651#msg343364 but nothing happened. Thanks for tackling this down. Any chance the fix will be in 3.8.0b4?

Comment 4 Christian Heimes 2019-08-28 05:33:39 UTC
You are welcome, Miro.

I saw your comment after I started digging into the issue, excellent deduction! :) I assume that the consequences were not fully clear to Victor and Eric. Almost nobody uses subinterpreters -- except for some embedded cases and mod_wsgi.

I forgot that 3.8b4 release is imminent. The fix has landed in 3.8 and 3.8b4 is scheduled to be released yesterday. I dropped Łukasz a mail and informed him that 3.8b4 is unblocked again. You are right, let's wait for 3.8b4.

Comment 5 Miro Hrončok 2019-09-02 07:56:32 UTC
Python was updated to 3.8.0b4. Reopen if it doesn't fix the issue.

Comment 6 Christian Heimes 2019-09-02 08:54:46 UTC
Confirmed, 3.8b4 fixed the problem with subinterpreters for FreeIPA and KDCProxy.

Thanks for getting the new build into rawhide so fast.