You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2018/03/16 23:55:50 UTC

mesos git commit: Fixed potential memory leak in the `volume/sandbox_path` isolator.

Repository: mesos
Updated Branches:
  refs/heads/master b738909aa -> 28ecf0c86


Fixed potential memory leak in the `volume/sandbox_path` isolator.

The `volume/sandbox_path` isolator inserts a string of the sandbox path
to its `sandboxes` hashmap instance variable upon the launch of each
container. However, it never cleans it up properly and can cause
unbounded growth of the hashmap object, as isolators are global
singleton objects.

The patch ensures the sandbox path associated with a given container ID
gets removed from the `sandboxes` hashmap upon container cleanup.

Review: https://reviews.apache.org/r/66104/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/28ecf0c8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/28ecf0c8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/28ecf0c8

Branch: refs/heads/master
Commit: 28ecf0c865347f75b90992a919ec7c56edb93eae
Parents: b738909
Author: Jason Lai <ja...@jasonlai.net>
Authored: Fri Mar 16 16:45:00 2018 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Mar 16 16:45:39 2018 -0700

----------------------------------------------------------------------
 .../containerizer/mesos/isolators/volume/sandbox_path.cpp | 10 ++++++++++
 .../containerizer/mesos/isolators/volume/sandbox_path.hpp |  3 +++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/28ecf0c8/src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp b/src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp
index 5801977..e0cae10 100644
--- a/src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp
+++ b/src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp
@@ -397,6 +397,16 @@ Future<Option<ContainerLaunchInfo>> VolumeSandboxPathIsolatorProcess::prepare(
   return launchInfo;
 }
 
+
+Future<Nothing> VolumeSandboxPathIsolatorProcess::cleanup(
+    const ContainerID& containerId)
+{
+  // Remove the current container's sandbox path from `sandboxes`.
+  sandboxes.erase(containerId);
+
+  return Nothing();
+}
+
 } // namespace slave {
 } // namespace internal {
 } // namespace mesos {

http://git-wip-us.apache.org/repos/asf/mesos/blob/28ecf0c8/src/slave/containerizer/mesos/isolators/volume/sandbox_path.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/isolators/volume/sandbox_path.hpp b/src/slave/containerizer/mesos/isolators/volume/sandbox_path.hpp
index 20d5b32..75bb5df 100644
--- a/src/slave/containerizer/mesos/isolators/volume/sandbox_path.hpp
+++ b/src/slave/containerizer/mesos/isolators/volume/sandbox_path.hpp
@@ -47,6 +47,9 @@ public:
       const ContainerID& containerId,
       const mesos::slave::ContainerConfig& containerConfig);
 
+  virtual process::Future<Nothing> cleanup(
+      const ContainerID& containerId);
+
 private:
   VolumeSandboxPathIsolatorProcess(
       const Flags& flags,