You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2018/08/28 14:48:45 UTC
[mesos] 02/02: Cleaned up container on launch failures in composing
containerizer.
This is an automated email from the ASF dual-hosted git repository.
alexr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 5fbfb8da5ad62c40752fa7b7e0a0842c892f6857
Author: Andrei Budnik <ab...@mesosphere.com>
AuthorDate: Tue Aug 28 16:47:04 2018 +0200
Cleaned up container on launch failures in composing containerizer.
Previously, if a parent container was unknown to the composing
containerizer during an attempt to launch a nested container
via `ComposingContainerizerProcess::launch()`, the composing
containerizer returned an error without cleaning up the container.
The `containerizer` field was uninitialized, so a further attempt
to remove or destroy the nested container led to segfault.
This patch removes the container when the parent container is unknown.
Review: https://reviews.apache.org/r/68235/
---
src/slave/containerizer/composing.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/slave/containerizer/composing.cpp b/src/slave/containerizer/composing.cpp
index 5216458..d854794 100644
--- a/src/slave/containerizer/composing.cpp
+++ b/src/slave/containerizer/composing.cpp
@@ -445,6 +445,11 @@ Future<Containerizer::LaunchResult> ComposingContainerizerProcess::launch(
if (containerId.has_parent()) {
ContainerID rootContainerId = protobuf::getRootContainerId(containerId);
if (!containers_.contains(rootContainerId)) {
+ // We do cleanup here, otherwise we cannot remove or destroy the nested
+ // container due to its undefined `containerizer` field.
+ containers_.erase(containerId);
+ delete container;
+
return Failure(
"Root container " + stringify(rootContainerId) + " not found");
}