subprocess: retry killing stopped process on failure
Sometimes we fail to stop a process with EPERM, maybe
because it's in an uninterruptable state in the kernel?
Keep trying.
This creates log messages like:
Failed to send SIGKILL to 'foobar' pid: 17341: Operation not permitted [1]
Change-Id: I3c030208a72ceffa965c42a3ae4874bfb754357e
Signed-off-by: James Kuszmaul <james.kuszmaul@bluerivertech.com>
diff --git a/aos/starter/subprocess.cc b/aos/starter/subprocess.cc
index faa1873..7b5fce6 100644
--- a/aos/starter/subprocess.cc
+++ b/aos/starter/subprocess.cc
@@ -144,6 +144,11 @@
LOG_IF(WARNING, quiet_flag_ == QuietLogging::kNo)
<< "Failed to stop, sending SIGKILL to '" << name_
<< "' pid: " << pid_;
+ } else {
+ PLOG_IF(WARNING, quiet_flag_ == QuietLogging::kNo)
+ << "Failed to send SIGKILL to '" << name_ << "' pid: " << pid_;
+ stop_timer_->Schedule(event_loop_->monotonic_now() +
+ std::chrono::seconds(1));
}
})),
pipe_timer_(event_loop_->AddTimer([this]() { FetchOutputs(); })),