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/09/21 12:52:22 UTC
[mesos] 01/02: Fixed disconnection while sending acknowledgment to
IOSwitchboard.
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 bfa2bd24780b5c49467b3c23260855e3d8b4c948
Author: Andrei Budnik <ab...@mesosphere.com>
AuthorDate: Fri Sep 21 14:51:24 2018 +0200
Fixed disconnection while sending acknowledgment to IOSwitchboard.
Previously, an HTTP connection to the IOSwitchboard could be garbage
collected before the agent sent an acknowledgment to the IOSwitchboard
via this connection. This patch fixes the issue by keeping a reference
count to the connection in a lambda callback until disconnection
occurs.
Review: https://reviews.apache.org/r/68768/
---
src/slave/http.cpp | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/slave/http.cpp b/src/slave/http.cpp
index bf34ef7..0011ced 100644
--- a/src/slave/http.cpp
+++ b/src/slave/http.cpp
@@ -3140,7 +3140,12 @@ Future<Response> Http::_attachContainerInput(
// so that the IOSwitchboard process can terminate itself. This is
// a workaround for the problem with dropping outstanding HTTP
// responses due to a lack of graceful shutdown in libprocess.
- acknowledgeContainerInputResponse(containerId);
+ acknowledgeContainerInputResponse(containerId)
+ .onFailed([containerId](const string& failure) {
+ LOG(ERROR) << "Failed to send an acknowledgment to the"
+ << " IOSwitchboard for container '"
+ << containerId << "': " << failure;
+ });
}));
}));
}
@@ -3156,6 +3161,13 @@ Future<Response> Http::acknowledgeContainerInputResponse(
request.url.domain = "";
request.url.path = "/acknowledge_container_input_response";
+ // This is a non Keep-Alive request which means the connection
+ // will be closed when the response is received. Since the
+ // 'Connection' is reference-counted, we must maintain a copy
+ // until the disconnection occurs.
+ connection.disconnected()
+ .onAny([connection]() {});
+
return connection.send(request);
});
}