From 22efe15379a33798aae6423729dc4d7edbb3dafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 15 Sep 2020 09:55:32 +0200 Subject: [PATCH] pkgset: Handle exceptions in pkgset threads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two thread pools for making package sets. If Pungi is being terminated by external event and the exception is handled in the first thread, the second one never gets to the `stop` method and the process keeps hanging. This patch should make sure that `stop()` is called on both pools. JIRA: RHELCMP-2459 Signed-off-by: Lubomír Sedlář --- pungi/phases/pkgset/common.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pungi/phases/pkgset/common.py b/pungi/phases/pkgset/common.py index fa7e3f43..88272125 100644 --- a/pungi/phases/pkgset/common.py +++ b/pungi/phases/pkgset/common.py @@ -271,8 +271,13 @@ class MaterializedPackageSet(object): small_pool.start() big_pool.start() - small_pool.stop() - big_pool.stop() + try: + small_pool.stop() + except Exception: + big_pool.kill() + raise + finally: + big_pool.stop() return small_pool.results + big_pool.results