From 57e705164a779fbf24db38fa915f56f1a772aa6b Mon Sep 17 00:00:00 2001 From: Marcel Loose Date: Fri, 2 May 2025 16:39:59 +0200 Subject: [PATCH] Check exit code of each joined process We need to check the exit code of each joined process in the `run_tasks()` function in `multi_proc.py`. A non-zero exit status (especially a negative exit status) indicates that an error occurred, and it is possible that the output queue (`out_q`) will be empty. Not handling this situation properly, will cause `out_q.get()` (a few lines further) to hang. --- bdsf/multi_proc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bdsf/multi_proc.py b/bdsf/multi_proc.py index 220a610e..049b447f 100644 --- a/bdsf/multi_proc.py +++ b/bdsf/multi_proc.py @@ -108,6 +108,10 @@ def run_tasks(procs, err_q, out_q, num): for proc in procs: proc.join() + if proc.exitcode != 0: + raise RuntimeError( + f"Process {proc.name} died unexpectedly (exit code: {proc.exitcode})" + ) except Exception as e: # kill all slave processes on ctrl-C