From 8d1b1a862dd8093bb0be00f8b424dea5698b2c75 Mon Sep 17 00:00:00 2001 From: Jiakai Zhang Date: Fri, 7 Jun 2024 13:14:32 +0000 Subject: Revert "Kill the child process when the parent process dies." This reverts commit 7afcee1180986d8b87773d173af7ecd63859ffe3. Reason for revert: It doesn't work. See details in b/345723405#comment2 We'll find an alternative. Bug: 345723405 Bug: 311377497 Change-Id: I70152124bb2f996c5211b4f4bdf9519e80bdf6ca Test: Presubmit --- runtime/exec_utils.cc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/runtime/exec_utils.cc b/runtime/exec_utils.cc index 17550d5aae..7e04cced92 100644 --- a/runtime/exec_utils.cc +++ b/runtime/exec_utils.cc @@ -17,8 +17,6 @@ #include "exec_utils.h" #include -#include -#include #include #include #include @@ -64,10 +62,6 @@ std::string ToCommandLine(const std::vector& args) { // If there is a runtime (Runtime::Current != nullptr) then the subprocess is created with the // same environment that existed when the runtime was started. // Returns the process id of the child process on success, -1 otherwise. -// The child is killed as soon as the caller thread dies, the caller thread needs to stay around and -// wait for the child. Therefore, this function is most suitable to be used by -// `ExecAndReturnResult`, which does the wait. It's not suitable to be used for fire-and-forget -// exec's. pid_t ExecWithoutWait(const std::vector& arg_vector, std::string* error_msg) { // Convert the args to char pointers. const char* program = arg_vector[0].c_str(); @@ -86,12 +80,6 @@ pid_t ExecWithoutWait(const std::vector& arg_vector, std::string* e // change process groups, so we don't get reaped by ProcessManager setpgid(0, 0); - // Kill the child process when the parent process dies. - if (prctl(PR_SET_PDEATHSIG, SIGKILL) != 0) { - // This should never happen. - PLOG(FATAL) << "Failed to call prctl"; - } - // (b/30160149): protect subprocesses from modifications to LD_LIBRARY_PATH, etc. // Use the snapshot of the environment from the time the runtime was created. char** envp = (Runtime::Current() == nullptr) ? nullptr : Runtime::Current()->GetEnvSnapshot(); -- cgit v1.2.3-59-g8ed1b