From 18182b11da5ff05df4e224ba747921ca0aa88202 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Thu, 11 Mar 2021 15:17:49 +0100 Subject: [PATCH] base: exit loop on cpu session close if session can't be closed immediately, e.g. if the service is provided by a child (cpu_balancer) and not by the parent. Issue #4029 --- repos/base/src/lib/base/child.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/repos/base/src/lib/base/child.cc b/repos/base/src/lib/base/child.cc index adadfc05cc..e7a8ac9904 100644 --- a/repos/base/src/lib/base/child.cc +++ b/repos/base/src/lib/base/child.cc @@ -870,8 +870,13 @@ void Child::close_all_sessions() * warnings generated by threads that are losing their PD while still * running. */ - while (unsigned long id_value = any_cpu_session_id(_id_space).value) - (void)close(Parent::Client::Id{id_value}); + while (unsigned long id_value = any_cpu_session_id(_id_space).value) { + Close_result const close_result = close(Parent::Client::Id{id_value}); + + /* break infinte loop if CPU session is provided by a child */ + if (close_result != CLOSE_DONE) + break; + } _initial_thread.destruct();