Wait for command processor thread to stop

While running zuul tests in an endless loop I discovered a test
failure [1] because a command processor thread was still running. The
thread is correctly signaled to stop but we don't wait for it to stop.

[1] Trace:
2018-11-28 11:36:34,502 zuul.test                        DEBUG    Thread: 139680540497664'
  File "/usr/lib/python3.5/threading.py", line 882, in _bootstrap'
    self._bootstrap_inner()'
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner'
    self.run()'
  File "/usr/lib/python3.5/threading.py", line 862, in run'
    self._target(*self._args, **self._kwargs)'
  File "/home/cloud/zuul-test/zuul/scheduler.py", line 336, in runCommand'
    command = self.command_socket.get().decode('utf8')"
  File "/home/cloud/zuul-test/zuul/lib/commandsocket.py", line 83, in get'
    return self.queue.get()'
  File "/usr/lib/python3.5/queue.py", line 164, in get'
    self.not_empty.wait()'
  File "/usr/lib/python3.5/threading.py", line 293, in wait'
    waiter.acquire()'

Change-Id: I7af562c9dc4ee7129dcabd5ba23b900b331d54de
This commit is contained in:
Tobias Henkel 2019-03-07 23:38:32 +01:00
parent 603ce6f474
commit 988801f6a5
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 1 additions and 0 deletions

View File

@ -346,6 +346,7 @@ class Scheduler(threading.Thread):
self.rpc.join()
self._command_running = False
self.command_socket.stop()
self.command_thread.join()
def runCommand(self):
while self._command_running: