From 980ae723bc47ec7685a1af9469adb2622dd22713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Tue, 26 Nov 2019 12:47:52 +0100 Subject: [PATCH] Propagate errors from gather methods --- 1303.patch | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ pungi.spec | 6 +++++- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 1303.patch diff --git a/1303.patch b/1303.patch new file mode 100644 index 00000000..922ca911 --- /dev/null +++ b/1303.patch @@ -0,0 +1,61 @@ +From 7f35ac622a7389a3b2077b245d7f322918b03515 Mon Sep 17 00:00:00 2001 +From: Lubomír Sedlář +Date: Nov 25 2019 13:28:34 +0000 +Subject: gather: Collect and re-raise errors from gather method + + +When there is an exception in gathering (such as after seeing unsigned +packages in deps method), the exception was lost and the compose +continued to run until it tried to access the result and crashed on +KeyError. + +Relates: https://pagure.io/releng/failed-composes/issue/587 +JIRA: COMPOSE-3986 +Signed-off-by: Lubomír Sedlář + +--- + +diff --git a/pungi/phases/gather/__init__.py b/pungi/phases/gather/__init__.py +index 444a8c2..9d54f15 100644 +--- a/pungi/phases/gather/__init__.py ++++ b/pungi/phases/gather/__init__.py +@@ -443,6 +443,7 @@ def _gather_variants(result, compose, variant_type, package_sets, exclude_fulltr + continue + threads_list = [] + que = Queue() ++ errors = Queue() + for arch in variant.arches: + fulltree_excludes = set() + if exclude_fulltree: +@@ -454,11 +455,17 @@ def _gather_variants(result, compose, variant_type, package_sets, exclude_fulltr + # there. + _update_lookaside_config(compose, variant, arch, result, package_sets) + ++ def worker(que, errors, arch, *args, **kwargs): ++ try: ++ que.put((arch, gather_packages(*args, **kwargs))) ++ except Exception as exc: ++ errors.put(exc) ++ + # Run gather_packages() in parallel with multi threads and store + # its return value in a Queue() for later use. + t = threading.Thread( +- target=lambda q, arch, *args, **kwargs: q.put((arch, gather_packages(*args, **kwargs))), +- args=(que, arch, compose, arch, variant, package_sets), ++ target=worker, ++ args=(que, errors, arch, compose, arch, variant, package_sets), + kwargs={'fulltree_excludes': fulltree_excludes}, + ) + threads_list.append(t) +@@ -467,6 +474,10 @@ def _gather_variants(result, compose, variant_type, package_sets, exclude_fulltr + for t in threads_list: + t.join() + ++ while not errors.empty(): ++ exc = errors.get() ++ raise exc ++ + while not que.empty(): + arch, pkg_map = que.get() + result.setdefault(arch, {})[variant.uid] = pkg_map + diff --git a/pungi.spec b/pungi.spec index 3cd2a672..94c69146 100644 --- a/pungi.spec +++ b/pungi.spec @@ -2,7 +2,7 @@ Name: pungi Version: 4.1.40 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Distribution compose tool License: GPLv2 @@ -10,6 +10,7 @@ URL: https://pagure.io/pungi Source0: https://pagure.io/releases/%{name}/%{name}-%{version}.tar.bz2 Patch1: https://pagure.io/pungi/pull-request/1292.patch Patch2: https://pagure.io/pungi/pull-request/1295.patch +Patch3: https://pagure.io/pungi/pull-request/1303.patch BuildRequires: python3-nose BuildRequires: python3-mock @@ -143,6 +144,9 @@ nosetests-3 --exe %{_bindir}/%{name}-wait-for-signed-ostree-handler %changelog +* Tue Nov 26 2019 Lubomír Sedlář - 4.1.40-4 +- Propagate errors from depsolving methods + * Mon Nov 11 2019 Lubomír Sedlář - 4.1.40-3 - pkgset: Fix running without any koji tags