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

Fixes #74149
This commit is contained in:
Martin Krizek 2021-04-06 18:26:52 +02:00 committed by GitHub
parent d1842afd59
commit 96f94c0fef
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 # TODO: Evaluate overhauling ``Display`` to not write directly to stdout
# and evaluate migrating away from the ``fork`` multiprocessing start method. # and evaluate migrating away from the ``fork`` multiprocessing start method.
if sys.version_info[0] >= 3: if sys.version_info[0] >= 3:
sys.stdout = os.devnull sys.stdout = sys.stderr = open(os.devnull, 'w')
sys.stderr = os.devnull
def _run(self): def _run(self):
''' '''