From 564d931134190a88026b74238d534d6b0624adb3 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 19 Oct 2024 16:17:58 +0200 Subject: libstore: always release build/substitution slot tokens not doing this can freeze slots until the goal that occupied them is freed (rather than simply complete), and then can freeze the system. fixes #549 Change-Id: I042df04222f8ffbaa18ef4a4eae6cbd6f89b679e --- src/libstore/build/goal.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libstore/build') diff --git a/src/libstore/build/goal.cc b/src/libstore/build/goal.cc index 02b22b8ad..db16e2cf8 100644 --- a/src/libstore/build/goal.cc +++ b/src/libstore/build/goal.cc @@ -22,6 +22,12 @@ kj::Promise Goal::waitForAWhile() kj::Promise> Goal::work() noexcept try { + // always clear the slot token, no matter what happens. not doing this + // can cause builds to get stuck on exceptions (or other early exist). + // ideally we'd use scoped slot tokens instead of keeping them in some + // goal member variable, but we cannot do this yet for legacy reasons. + KJ_DEFER({ slotToken = {}; }); + BOOST_OUTCOME_CO_TRY(auto result, co_await workImpl()); trace("done"); -- cgit v1.2.3