summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuren Baghdasaryan <surenb@google.com>2022-04-28 13:26:59 -0700
committerSuren Baghdasaryan <surenb@google.com>2022-05-04 00:44:47 +0000
commit870725ac14440939b9bb7939f0ee1af1102f8a67 (patch)
tree7752f9ba6493e355823a62d228169c5eee2a819a
parent6761b6dcdc31a10d7e1b3652400bfae9eb2eed17 (diff)
downloadcore-870725ac14440939b9bb7939f0ee1af1102f8a67.tar.gz
init: Purge empty process groups on zygote restart
When system_server crashes or gets killed, it causes zygote to kill itself, which in turn leads to killing all processes in the same process group (all apps). This leaves empty process groups because system_server is not there to remove them. Purge empty process groups when init detects zygote death. Bug: 228160715 Signed-off-by: Suren Baghdasaryan <surenb@google.com> Change-Id: I0ce27eea28f8713e52033bbec2d5363a7b8ff5db Merged-In: I0ce27eea28f8713e52033bbec2d5363a7b8ff5db
-rw-r--r--init/service.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/init/service.cpp b/init/service.cpp
index 0f2443741..3fa935fdd 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -289,6 +289,10 @@ void Service::Reap(const siginfo_t& siginfo) {
if (flags_ & SVC_EXEC) UnSetExec();
+ if (name_ == "zygote" || name_ == "zygote64") {
+ removeAllEmptyProcessGroups();
+ }
+
if (flags_ & SVC_TEMPORARY) return;
pid_ = 0;