You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/09/17 21:27:19 UTC

svn commit: r1386781 - in /incubator/mesos/trunk/src: launcher/launcher.cpp slave/cgroups_isolation_module.cpp slave/process_based_isolation_module.cpp

Author: benh
Date: Mon Sep 17 19:27:19 2012
New Revision: 1386781

URL: http://svn.apache.org/viewvc?rev=1386781&view=rev
Log:
Bug fixes for updates in executor launcher
(https://reviews.apache.org/r/7005).

Modified:
    incubator/mesos/trunk/src/launcher/launcher.cpp
    incubator/mesos/trunk/src/slave/cgroups_isolation_module.cpp
    incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp

Modified: incubator/mesos/trunk/src/launcher/launcher.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/launcher/launcher.cpp?rev=1386781&r1=1386780&r2=1386781&view=diff
==============================================================================
--- incubator/mesos/trunk/src/launcher/launcher.cpp (original)
+++ incubator/mesos/trunk/src/launcher/launcher.cpp Mon Sep 17 19:27:19 2012
@@ -82,13 +82,13 @@ int ExecutorLauncher::setup()
   // TODO(benh): Do this in the slave?
   if (shouldSwitchUser && !os::chown(user, workDirectory)) {
     VLOG(1) << "Failed to change ownership of framework's working directory "
-            << workDirectory.c_str() << " to user " << user.c_str();
+            << workDirectory << " to user " << user;
     return -1;
   }
 
   // Enter working directory.
   if (os::chdir(workDirectory) < 0) {
-    VLOG(1) << "chdir into framework working directory failed";
+    VLOG(1) << "Failed to chdir into framework working directory";
     return -1;
   }
 
@@ -99,7 +99,7 @@ int ExecutorLauncher::setup()
 
   // Go back to previous directory.
   if (os::chdir(cwd) < 0) {
-    VLOG(1) << "chdir into slave directory failed";
+    VLOG(1) << "Failed to chdir (back) into slave directory";
     return -1;
   }
 
@@ -110,8 +110,8 @@ int ExecutorLauncher::setup()
 int ExecutorLauncher::launch()
 {
   // Enter working directory.
-  if (chdir(workDirectory.c_str()) < 0) {
-    fatalerror("chdir into framework working directory failed");
+  if (os::chdir(workDirectory) < 0) {
+    fatalerror("Failed to chdir into framework working directory");
   }
 
   if (shouldSwitchUser) {
@@ -269,13 +269,13 @@ int ExecutorLauncher::fetchExecutors()
     }
 
     if (shouldSwitchUser && !os::chown(user, resource)) {
-      VLOG(1) << "chown failed";
+      VLOG(1) << "Failed to chown " << resource;
       return -1;
     }
 
     if (executable &&
         !os::chmod(resource, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
-      VLOG(1) << "chmod failed";
+      VLOG(1) << "Failed to chmod " << resource;
       return -1;
     }
 

Modified: incubator/mesos/trunk/src/slave/cgroups_isolation_module.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/cgroups_isolation_module.cpp?rev=1386781&r1=1386780&r2=1386781&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/cgroups_isolation_module.cpp (original)
+++ incubator/mesos/trunk/src/slave/cgroups_isolation_module.cpp Mon Sep 17 19:27:19 2012
@@ -259,7 +259,22 @@ void CgroupsIsolationModule::launchExecu
                                                                 directory);
 
   if (launcher->setup() < 0) {
-    LOG(ERROR) << "Error setting up executor " << executorId;
+    LOG(ERROR) << "Error setting up executor " << executorId
+               << " for framework " << frameworkId;
+
+    delete launcher;
+
+    unregisterCgroupInfo(frameworkId, executorId);
+
+    LOG(INFO) << "Telling slave of lost executor " << executorId
+              << " of framework " << frameworkId;
+
+    dispatch(slave,
+             &Slave::executorExited,
+             frameworkId,
+             executorId,
+             -1); // TODO(benh): Determine "correct" status.
+
     return;
   }
 
@@ -345,6 +360,7 @@ void CgroupsIsolationModule::launchExecu
              executorId,
              pid);
   } else {
+    // In child process.
     // Put self into the newly created cgroup.
     Try<bool> assign =
       cgroups::assignTask(hierarchy,

Modified: incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp?rev=1386781&r1=1386780&r2=1386781&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp (original)
+++ incubator/mesos/trunk/src/slave/process_based_isolation_module.cpp Mon Sep 17 19:27:19 2012
@@ -181,7 +181,9 @@ void ProcessBasedIsolationModule::launch
       createExecutorLauncher(frameworkId, frameworkInfo,
                              executorInfo, directory);
 
-    launcher->run();
+    if (launcher->run() < 0) {
+      LOG(FATAL) << "Failed to launch executor";
+    }
   }
 }