You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bb...@apache.org on 2017/12/21 17:23:42 UTC
mesos git commit: Fixed a crash when resubscribing resource providers.
Repository: mesos
Updated Branches:
refs/heads/master 3547410ad -> 7db362c9e
Fixed a crash when resubscribing resource providers.
If a resource provider resubscribed while its old HTTP connection was
still open, the agent would crash, as a continuation would be called
erroneously. This continuation is now only called when a HTTP connection
is closed by a remote side (i.e. the resource provider) and not when
the resource provider manager closes the connection.
Review: https://reviews.apache.org/r/64713/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/7db362c9
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/7db362c9
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/7db362c9
Branch: refs/heads/master
Commit: 7db362c9e3428d72bc20b549d1988d7eb40c8fca
Parents: 3547410
Author: Jan Schlicht <ja...@mesosphere.io>
Authored: Thu Dec 21 09:57:59 2017 +0100
Committer: Benjamin Bannier <bb...@apache.org>
Committed: Thu Dec 21 18:17:57 2017 +0100
----------------------------------------------------------------------
src/resource_provider/manager.cpp | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/7db362c9/src/resource_provider/manager.cpp
----------------------------------------------------------------------
diff --git a/src/resource_provider/manager.cpp b/src/resource_provider/manager.cpp
index 957642d..6434693 100644
--- a/src/resource_provider/manager.cpp
+++ b/src/resource_provider/manager.cpp
@@ -600,12 +600,18 @@ void ResourceProviderManagerProcess::subscribe(
}
http.closed()
- .onAny(defer(self(), [=](const Future<Nothing>&) {
- CHECK(resourceProviders.subscribed.contains(resourceProviderId));
-
- // NOTE: All pending futures of publish requests for the resource
- // provider will become failed.
- resourceProviders.subscribed.erase(resourceProviderId);
+ .onAny(defer(self(), [=](const Future<Nothing>& future) {
+ // Iff the remote side closes the HTTP connection, the future will be
+ // ready. We will remove the resource provider in that case.
+ // This side closes the HTTP connection only when removing a resource
+ // provider, therefore we shouldn't try to remove it again here.
+ if (future.isReady()) {
+ CHECK(resourceProviders.subscribed.contains(resourceProviderId));
+
+ // NOTE: All pending futures of publish requests for the resource
+ // provider will become failed.
+ resourceProviders.subscribed.erase(resourceProviderId);
+ }
ResourceProviderMessage::Disconnect disconnect{resourceProviderId};