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/01/17 17:01:41 UTC
[1/2] mesos git commit: Updated comments in IOSwitchboard.
Repository: mesos
Updated Branches:
refs/heads/master 19cf3068b -> 52a55debe
Updated comments in IOSwitchboard.
This is addendum to review https://reviews.apache.org/r/65122
Review: https://reviews.apache.org/r/65190/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ff691582
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ff691582
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ff691582
Branch: refs/heads/master
Commit: ff6915822140fb243d0711102922969e03c85f2d
Parents: 19cf306
Author: Andrei Budnik <ab...@mesosphere.com>
Authored: Wed Jan 17 17:15:38 2018 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Wed Jan 17 17:15:38 2018 +0100
----------------------------------------------------------------------
.../containerizer/mesos/io/switchboard.cpp | 29 +++++++++++---------
1 file changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ff691582/src/slave/containerizer/mesos/io/switchboard.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/mesos/io/switchboard.cpp b/src/slave/containerizer/mesos/io/switchboard.cpp
index a1a50ce..45b615b 100644
--- a/src/slave/containerizer/mesos/io/switchboard.cpp
+++ b/src/slave/containerizer/mesos/io/switchboard.cpp
@@ -1180,11 +1180,12 @@ Future<Nothing> IOSwitchboardServerProcess::run()
// fail the future.
//
// For now we simply assume that whenever both `stdoutRedirect`
- // and `stderrRedirect` have completed then it is OK to exit the
- // switchboard process. We assume this because `stdoutRedirect`
- // and `stderrRedirect` will only complete after both the read end
- // of the `stdout` stream and the read end of the `stderr` stream
- // have been drained. Since draining these `fds` represents having
+ // and `stderrRedirect` have completed while there is no input
+ // connected then it is OK to exit the switchboard process.
+ // We assume this because `stdoutRedirect` and `stderrRedirect`
+ // will only complete after both the read end of the `stdout`
+ // stream and the read end of the `stderr` stream have been
+ // drained. Since draining these `fds` represents having
// read everything possible from a container's `stdout` and
// `stderr` this is likely sufficient termination criteria.
// However, there's a non-zero chance that *some* containers may
@@ -1193,6 +1194,12 @@ Future<Nothing> IOSwitchboardServerProcess::run()
// containers with this behavior and we will exit out of the
// switchboard process early.
//
+ // If our IO redirects are finished and there is an input connected,
+ // then we postpone our termination until either a container closes
+ // its `stdin` or a client closes the input connection so that we can
+ // guarantee returning a http response for `ATTACH_CONTAINER_INPUT`
+ // request before terminating ourselves.
+ //
// NOTE: We always call `terminate()` with `false` to ensure
// that our event queue is drained before actually terminating.
// Without this, it's possible that we might drop some data we
@@ -1224,9 +1231,6 @@ Future<Nothing> IOSwitchboardServerProcess::run()
.then(defer(self(), [this]() {
redirectFinished = true;
- // Postpone termination if input is connected. This gives us a chance
- // to properly close the input connection and send an http response,
- // see `attachContainerInput()`.
if (!inputConnected) {
terminate(self(), false);
}
@@ -1673,11 +1677,10 @@ Future<http::Response> IOSwitchboardServerProcess::attachContainerInput(
// Reset `inputConnected` to allow future input connections.
inputConnected = false;
- // We only set `failure` if writing to `stdin` failed, in which case we
- // want to terminate ourselves (after flushing any outstanding messages
- // from our message queue). Also, if IO redirect has already finished,
- // we can safely terminate.
- if (failure.isSome() || redirectFinished) {
+ // If IO redirects are finished or writing to `stdin` failed we want
+ // to terminate ourselves (after flushing any outstanding messages
+ // from our message queue).
+ if (redirectFinished || failure.isSome()) {
terminate(self(), false);
}
[2/2] mesos git commit: Fixed flaky EOFBeforeRecv test.
Posted by al...@apache.org.
Fixed flaky EOFBeforeRecv test.
This patch is a small correction of commit d4185d4a11.
Before this patch, if EOF event for a ssl socket is received before
a client called `recv`, then this EOF event is lost. This leads to
hanging `recv` on the ssl socket after calling `shutdown`.
Review: https://reviews.apache.org/r/65179/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/52a55deb
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/52a55deb
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/52a55deb
Branch: refs/heads/master
Commit: 52a55debebdba2f40361dafc5c10cf9d1b1a584d
Parents: ff69158
Author: Andrei Budnik <ab...@mesosphere.com>
Authored: Wed Jan 17 18:00:53 2018 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Wed Jan 17 18:00:53 2018 +0100
----------------------------------------------------------------------
3rdparty/libprocess/src/libevent_ssl_socket.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/52a55deb/3rdparty/libprocess/src/libevent_ssl_socket.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/libevent_ssl_socket.cpp b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
index 1c95eba..d5ce25f 100644
--- a/3rdparty/libprocess/src/libevent_ssl_socket.cpp
+++ b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
@@ -385,9 +385,9 @@ void LibeventSSLSocketImpl::event_callback(short events)
// recv errors, but perhaps we should?
if (events & BEV_EVENT_EOF ||
(events & BEV_EVENT_ERROR && EVUTIL_SOCKET_ERROR() == 0)) {
- if (current_recv_request.get() != nullptr) {
- received_eof = true;
+ received_eof = true;
+ if (current_recv_request.get() != nullptr) {
// Drain any remaining data from the bufferevent or complete the
// promise with 0 to signify EOF. Because we set `received_eof`,
// subsequent calls to `recv` will return 0 if there is no data