mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1419896 - in /incubator/mesos/branches/0.10.x/src/slave: cgroups_isolation_module.cpp cgroups_isolation_module.hpp
Date Mon, 10 Dec 2012 23:59:29 GMT
Author: benh
Date: Mon Dec 10 23:59:28 2012
New Revision: 1419896

URL: http://svn.apache.org/viewvc?rev=1419896&view=rev
Log:
Fixing memory leak in cgroups isolation module.

Modified:
    incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.cpp
    incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.hpp

Modified: incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.cpp?rev=1419896&r1=1419895&r2=1419896&view=diff
==============================================================================
--- incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.cpp (original)
+++ incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.cpp Mon Dec 10 23:59:28
2012
@@ -253,17 +253,23 @@ void CgroupsIsolationModule::launchExecu
             << " in cgroup " << getCgroupName(frameworkId, executorId);
 
   // First fetch the executor.
-  launcher::ExecutorLauncher* launcher = createExecutorLauncher(frameworkId,
-                                                                frameworkInfo,
-                                                                executorInfo,
-                                                                directory);
+  launcher::ExecutorLauncher launcher(
+      frameworkId,
+      executorInfo.executor_id(),
+      executorInfo.command(),
+      frameworkInfo.user(),
+      directory,
+      slave,
+      flags.frameworks_home,
+      flags.hadoop_home,
+      !local,
+      flags.switch_user,
+      "");
 
-  if (launcher->setup() < 0) {
+  if (launcher.setup() < 0) {
     LOG(ERROR) << "Error setting up executor " << executorId
                << " for framework " << frameworkId;
 
-    delete launcher;
-
     unregisterCgroupInfo(frameworkId, executorId);
 
     LOG(INFO) << "Telling slave of lost executor " << executorId
@@ -372,8 +378,8 @@ void CgroupsIsolationModule::launchExecu
                  << ": " << assign.error();
     }
 
-    // Now launch the executor.
-    launcher->launch();
+    // Now launch the executor (this function should not return).
+    launcher.launch();
   }
 }
 
@@ -483,27 +489,6 @@ void CgroupsIsolationModule::processExit
 }
 
 
-launcher::ExecutorLauncher* CgroupsIsolationModule::createExecutorLauncher(
-    const FrameworkID& frameworkId,
-    const FrameworkInfo& frameworkInfo,
-    const ExecutorInfo& executorInfo,
-    const std::string& directory)
-{
-  return new launcher::ExecutorLauncher(
-      frameworkId,
-      executorInfo.executor_id(),
-      executorInfo.command(),
-      frameworkInfo.user(),
-      directory,
-      slave,
-      flags.frameworks_home,
-      flags.hadoop_home,
-      !local,
-      flags.switch_user,
-      "");
-}
-
-
 Try<bool> CgroupsIsolationModule::cpusChanged(
     const FrameworkID& frameworkId,
     const ExecutorID& executorId,

Modified: incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.hpp?rev=1419896&r1=1419895&r2=1419896&view=diff
==============================================================================
--- incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.hpp (original)
+++ incubator/mesos/branches/0.10.x/src/slave/cgroups_isolation_module.hpp Mon Dec 10 23:59:28
2012
@@ -92,16 +92,6 @@ private:
     process::Future<uint64_t> oomNotifier;
   };
 
-  // Main method executed after a fork() to create a Launcher for launching an
-  // executor's process. The Launcher will chdir() to the child's working
-  // directory, fetch the executor, set environment varibles, switch user, etc,
-  // and finally exec() the executor process.
-  launcher::ExecutorLauncher* createExecutorLauncher(
-      const FrameworkID& frameworkId,
-      const FrameworkInfo& frameworkInfo,
-      const ExecutorInfo& executorInfo,
-      const std::string& directory);
-
   // The callback which will be invoked when "cpus" resource has changed.
   // @param   frameworkId   The id of the given framework.
   // @param   executorId    The id of the given executor.



Mime
View raw message