Someone may add or remove a thread mid-iteration, which causes a RuntimeError. Instead, grab a copy of all the thread names and then iterate over that. --- pyanaconda/threads.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/threads.py b/pyanaconda/threads.py index 8f52260..1e8082f 100644 --- a/pyanaconda/threads.py +++ b/pyanaconda/threads.py @@ -120,7 +120,12 @@ class ThreadManager(object): def wait_all(self): """Wait for all threads to exit and if there was an error re-raise it. """ - for name in self._objs.keys(): + names = [] + + with self._objs_lock: + names = self._objs.keys() + + for name in names: if self.get(name) == threading.current_thread(): continue log.debug("Waiting for thread %s to exit", name)