From 6491ba05893f00d73b862e4458d5ed956606248e Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 12 Jun 2018 15:52:49 +0200 Subject: [PATCH] init: avoid too eager child restart This patch weakens the aggressive restart of a child with incomplete environment sessions. The restart check is performed each time the init configuration changes. In sculpt, this is not a rare special case anymore but a frequent case when using the depot_rom as provider for environment ROM sessions. In particular when starting a chain of inter-depending children, the sculpt-manager quickly generates a sequence of configurations with successively added start nodes. --- repos/os/src/init/child.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/repos/os/src/init/child.cc b/repos/os/src/init/child.cc index 559461caa..68417becb 100644 --- a/repos/os/src/init/child.cc +++ b/repos/os/src/init/child.cc @@ -33,9 +33,18 @@ Init::Child::apply_config(Xml_node start_node) * If the child's environment is incomplete, restart it to attempt * the re-routing of its environment sessions. */ - if (!_child.active()) { - abandon(); - return MAY_HAVE_SIDE_EFFECTS; + { + bool env_log_exists = false, env_binary_exists = false; + _child.for_each_session([&] (Session_state const &session) { + Parent::Client::Id const id = session.id_at_client(); + env_log_exists |= (id == Parent::Env::log()); + env_binary_exists |= (id == Parent::Env::binary()); + }); + + if (!env_binary_exists || !env_log_exists) { + abandon(); + return MAY_HAVE_SIDE_EFFECTS; + } } bool provided_services_changed = false;