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 2017/10/03 23:35:02 UTC
mesos git commit: Handled discarded case in launch nested container
handler.
Repository: mesos
Updated Branches:
refs/heads/master ae24a4bfc -> 9dfc36b49
Handled discarded case in launch nested container handler.
Previously, only the failure case is handled. This patch fix the issue
by handling discarded case as well.
Review: https://reviews.apache.org/r/62742
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/9dfc36b4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/9dfc36b4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/9dfc36b4
Branch: refs/heads/master
Commit: 9dfc36b49f9564f4284a0bf5e4fc0d53847011a3
Parents: ae24a4b
Author: Jie Yu <yu...@gmail.com>
Authored: Mon Oct 2 20:58:28 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Tue Oct 3 16:34:55 2017 -0700
----------------------------------------------------------------------
src/slave/http.cpp | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/9dfc36b4/src/slave/http.cpp
----------------------------------------------------------------------
diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index 3ea7829..f4c3e6b 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -2405,17 +2405,33 @@ Future<Response> Http::_launchNestedContainer(
map<string, string>(),
None());
+ // TODO(jieyu): If the http connection breaks, the handler will
+ // trigger a discard on the returned future. That'll result in the
+ // future 'launched' transitioning into DISCARDED state. However,
+ // this does not mean the launch was discarded correctly and it
+ // requires a destroy. See MESOS-8039 for more details.
+ //
// TODO(bmahler): The containerizers currently require that
// the caller calls destroy if the launch fails. See MESOS-6214.
launched
- .onFailed(defer(slave->self(), [=](const string& failure) {
- LOG(WARNING) << "Failed to launch nested container " << containerId
- << ": " << failure;
+ .onAny(defer(slave->self(), [=](const Future<bool>& launch) {
+ if (launch.isReady()) {
+ return;
+ }
+
+ LOG(WARNING) << "Failed to launch nested container "
+ << containerId << ": "
+ << (launch.isFailed() ? launch.failure() : "discarded");
slave->containerizer->destroy(containerId)
- .onFailed([=](const string& failure) {
- LOG(ERROR) << "Failed to destroy nested container " << containerId
- << " after launch failure: " << failure;
+ .onAny([=](const Future<bool>& destroy) {
+ if (destroy.isReady()) {
+ return;
+ }
+
+ LOG(ERROR) << "Failed to destroy nested container "
+ << containerId << " after launch failure: "
+ << (destroy.isFailed() ? destroy.failure() : "discarded");
});
}));