Commit 32c5eebf authored by Sebastien Robin's avatar Sebastien Robin

testnode: give time to supervisord to kill sub processes

supervirord when stopping might need several seconds to kill
properly sub processes. So give him some time before killing
more brutaly with killall.

This should solve issue with functional tests are not working
due to apache not starting. Apache when killed to brutally
let unclosed semaphore, and after some time, we have too many
semaphore to start new apache, making functional tests failing.
parent 1bbd5e6e
......@@ -228,7 +228,22 @@ class ProcessManager(object):
logger.debug('ProcessManager killPreviousRun,'
' going to kill supervisor with pid %r', pid)
os.kill(pid, signal.SIGTERM)
# Give at most two minutes to supervisord to stop everything
i = 0
while True:
try:
psutil.Process(pid)
logger.debug('ProcessManager killPreviousRun, supervisor still there with pid %r', pid)
except psutil.NoSuchProcess:
break
else:
time.sleep(1)
i += 1
if i > 120:
logger.debug('ProcessManager killPreviousRun, supervisor still there after two minutes %r', pid)
break
except Exception:
raise
logger.exception(
'ProcessManager killPreviousRun, exception when killing supervisor')
self.process_pid_set.clear()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment