This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch 1.6.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit afdbf14489114f8f004d212ec2b8bc2110d0eeb2
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 3ae3a56..d9493c4 100644
--- a/src/launcher/executor.cpp
+++ b/src/launcher/executor.cpp
@@ -403,7 +403,7 @@ protected:
     delay(Seconds(1), self(), &Self::doReliableRegistration);
   }
 
-  static pid_t launchTaskSubprocess(
+  static Subprocess launchTaskSubprocess(
       const CommandInfo& command,
       const string& launcherDir,
       const Environment& environment,
@@ -533,7 +533,7 @@ protected:
       ABORT("Failed to launch task subprocess: " + s.error());
     }
 
-    return s->pid();
+    return s.get();
   }
 
   void launch(const TaskInfo& task)
@@ -682,7 +682,7 @@ protected:
 
     LOG(INFO) << "Starting task " << taskId.get();
 
-    pid = launchTaskSubprocess(
+    Subprocess subprocess = launchTaskSubprocess(
         command,
         launcherDir,
         launchEnvironment,
@@ -694,6 +694,8 @@ protected:
         boundingCapabilities,
         ttySlavePath);
 
+    pid = subprocess.pid();
+
     LOG(INFO) << "Forked command at " << pid.get();
 
     if (task.has_check()) {
@@ -758,7 +760,7 @@ protected:
     }
 
     // Monitor this process.
-    process::reap(pid.get())
+    subprocess.status()
       .onAny(defer(self(), &Self::reaped, pid.get(), lambda::_1));
 
     TaskStatus status = createTaskStatus(taskId.get(), TASK_RUNNING);

Reply via email to