From 4b97dd0e2f192d6999285b83a0ee7260db7cf94f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Apr 2024 12:59:15 +0200 Subject: Fix deadlock in auxiliary machine interrupt logic --- bbot/agent/agent.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx index ff380c8..d6a7d4b 100644 --- a/bbot/agent/agent.cxx +++ b/bbot/agent/agent.cxx @@ -1984,6 +1984,17 @@ start_auxiliary_machines (const vector& ams, // string envs; // Combined environments. + auto amg ( + make_exception_guard ( + [&amrs] () + { + if (!amrs.empty ()) + { + info << "trying to force auxiliary machines down"; + stop_auxiliary_machines (amrs); + } + })); + for (size_t i (0); i != n; ++i) { const auxiliary_machine& tam (tm.auxiliary_machines[i]); @@ -1996,6 +2007,8 @@ start_auxiliary_machines (const vector& ams, })); assert (j != e); + // Note: can throw interrupt. + // pair p ( start_auxiliary_machine (**j, tam.environment_name, -- cgit v1.1