From commits-return-24696-archive-asf-public=cust-asf.ponee.io@mesos.apache.org Fri Sep 21 14:58:07 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 42A40180671 for ; Fri, 21 Sep 2018 14:58:07 +0200 (CEST) Received: (qmail 28891 invoked by uid 500); 21 Sep 2018 12:58:06 -0000 Mailing-List: contact commits-help@mesos.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mesos.apache.org Delivered-To: mailing list commits@mesos.apache.org Received: (qmail 28877 invoked by uid 99); 21 Sep 2018 12:58:06 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Sep 2018 12:58:06 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id C50D682E9B; Fri, 21 Sep 2018 12:58:05 +0000 (UTC) Date: Fri, 21 Sep 2018 12:58:06 +0000 To: "commits@mesos.apache.org" Subject: [mesos] 01/02: Fixed disconnection while sending acknowledgment to IOSwitchboard. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: alexr@apache.org In-Reply-To: <153753468569.21953.549948361947863764@gitbox.apache.org> References: <153753468569.21953.549948361947863764@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: mesos X-Git-Refname: refs/heads/1.7.x X-Git-Reftype: branch X-Git-Rev: 021a8f4de1ad65167946548e3ecfa74d8e41e9c5 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20180921125805.C50D682E9B@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. alexr pushed a commit to branch 1.7.x in repository https://gitbox.apache.org/repos/asf/mesos.git commit 021a8f4de1ad65167946548e3ecfa74d8e41e9c5 Author: Andrei Budnik 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/ (cherry picked from commit bfa2bd24780b5c49467b3c23260855e3d8b4c948) --- 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 2253ccc..51bc074 100644 --- a/src/slave/http.cpp +++ b/src/slave/http.cpp @@ -3147,7 +3147,12 @@ Future 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; + }); })); })); } @@ -3163,6 +3168,13 @@ Future 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); }); }