This is an automated email from the ASF dual-hosted git repository. bmahler pushed a commit to branch 1.5.x in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 3eb399556eda7753dc2ab7e41c442fd36dfb4aec Author: Benjamin Mahler <[email protected]> AuthorDate: Mon Oct 21 19:19:58 2019 -0400 Avoid double reaping race in the command executor. Previously, it was possible for the command executor to miss the exit status of the subprocess since it performs its own reap and doesn't use the Subprocess::status. See MESOS-10007. Review: https://reviews.apache.org/r/71652 --- src/launcher/executor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/launcher/executor.cpp b/src/launcher/executor.cpp index a130dc6..71834fc 100644 --- a/src/launcher/executor.cpp +++ b/src/launcher/executor.cpp @@ -396,7 +396,7 @@ protected: delay(Seconds(1), self(), &Self::doReliableRegistration); } - static pid_t launchTaskSubprocess( + static Subprocess launchTaskSubprocess( const CommandInfo& command, const string& launcherDir, const Environment& environment, @@ -521,7 +521,7 @@ protected: ABORT("Failed to launch task subprocess: " + s.error()); } - return s->pid(); + return s.get(); } void launch(const TaskInfo& task) @@ -655,7 +655,7 @@ protected: LOG(INFO) << "Starting task " << taskId.get(); - pid = launchTaskSubprocess( + Subprocess subprocess = launchTaskSubprocess( command, launcherDir, launchEnvironment, @@ -667,6 +667,8 @@ protected: boundingCapabilities, ttySlavePath); + pid = subprocess.pid(); + LOG(INFO) << "Forked command at " << pid; if (task.has_check()) { @@ -731,7 +733,7 @@ protected: } // Monitor this process. - process::reap(pid) + subprocess.status() .onAny(defer(self(), &Self::reaped, pid, lambda::_1)); TaskStatus status = createTaskStatus(taskId.get(), TASK_RUNNING);
