Use a file-like obj for stdout/stderr for deadlock workaround (#74156) (#74160)

Fixes #74149

(cherry picked from commit 96f94c0fef)
This commit is contained in:
Martin Krizek 2021-04-06 19:47:03 +02:00 committed by GitHub
parent 275d0acfa1
commit f196914e13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "WorkerProcess - Python 3.5 fix for workaround for stdout deadlock in multiprocessing shutdown to avoid process hangs. (https://github.com/ansible/ansible/issues/74149)"

View file

@ -145,8 +145,7 @@ class WorkerProcess(multiprocessing_context.Process):
# TODO: Evaluate overhauling ``Display`` to not write directly to stdout
# and evaluate migrating away from the ``fork`` multiprocessing start method.
if sys.version_info[0] >= 3:
sys.stdout = os.devnull
sys.stderr = os.devnull
sys.stdout = sys.stderr = open(os.devnull, 'w')
def _run(self):
'''