From 870725ac14440939b9bb7939f0ee1af1102f8a67 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Thu, 28 Apr 2022 13:26:59 -0700 Subject: [PATCH] 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 Change-Id: I0ce27eea28f8713e52033bbec2d5363a7b8ff5db Merged-In: I0ce27eea28f8713e52033bbec2d5363a7b8ff5db --- init/service.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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;