summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Westphahl <simon.westphahl@bmw.de>2020-05-12 09:37:18 +0200
committerSimon Westphahl <simon.westphahl@bmw.de>2020-05-12 09:42:05 +0200
commite02963f6e13127f4ad6d7d2aadd50544da732463 (patch)
tree2aebb5ccac773645c20a5328dd6169da82770df1
parentd873dc84ef34f052a83608cff609b8ec6f4c5719 (diff)
downloadzuul-e02963f6e13127f4ad6d7d2aadd50544da732463.tar.gz
Replace preexec_fn argument in executor popen call
According to the Python documentation the preexec_fn argument is not thread-safe and can cause a deadlock in the child process. The use of preexec_fn=os.setsid can be avoided by using start_new_session=True in the popen() call which is available in Python >= 3.2 DEBUG zuul.stack_dump: Thread: 139775071643392 build-e584032fcc424259be5b0feddfc3f0b4 d: True File "/usr/lib/python3.6/threading.py", line 884, in _bootstrap self._bootstrap_inner() File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/opt/zuul/lib/python3.6/site-packages/zuul/executor/server.py", line 931, in execute self._execute() File "/opt/zuul/lib/python3.6/site-packages/zuul/executor/server.py", line 1154, in _execute result = self.runPlaybooks(args) File "/opt/zuul/lib/python3.6/site-packages/zuul/executor/server.py", line 1437, in runPlaybooks phase='post', index=index) File "/opt/zuul/lib/python3.6/site-packages/zuul/executor/server.py", line 2464, in runAnsiblePlaybook cleanup=phase == 'cleanup') File "/opt/zuul/lib/python3.6/site-packages/zuul/executor/server.py", line 2210, in runAnsible env=env_copy, File "/opt/zuul/lib/python3.6/site-packages/zuul/driver/bubblewrap/__init__.py", line 55, in __call__ proc = psutil.Popen(args, *sub_args, **kwargs) File "/opt/zuul/lib/python3.6/site-packages/psutil/__init__.py", line 1322, in __init__ self.__subproc = subprocess.Popen(*args, **kwargs) File "/usr/lib/python3.6/subprocess.py", line 729, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1318, in _execute_child part = os.read(errpipe_read, 50000) Change-Id: I0b5110e0b29025f9bb121be26a678fcbe130ba73
-rw-r--r--zuul/executor/server.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index 381dc53d3..27cbcf98d 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -2203,7 +2203,7 @@ class AnsibleJob(object):
stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
- preexec_fn=os.setsid,
+ start_new_session=True,
env=env_copy,
)