Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 20DBC18460 for ; Mon, 1 Feb 2016 20:56:02 +0000 (UTC) Received: (qmail 96150 invoked by uid 500); 1 Feb 2016 20:55:27 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 96120 invoked by uid 500); 1 Feb 2016 20:55:27 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 96109 invoked by uid 99); 1 Feb 2016 20:55:27 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2016 20:55:27 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 60868C0DE3 for ; Mon, 1 Feb 2016 20:55:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.236 X-Spam-Level: * X-Spam-Status: No, score=1.236 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.545, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id CcMKyKef_C3l for ; Mon, 1 Feb 2016 20:55:20 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id AD81B233F1 for ; Mon, 1 Feb 2016 20:55:18 +0000 (UTC) Received: (qmail 94458 invoked by uid 99); 1 Feb 2016 20:55:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2016 20:55:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 57E97E0B66; Mon, 1 Feb 2016 20:55:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: klund@apache.org To: commits@geode.incubator.apache.org Date: Mon, 01 Feb 2016 20:55:29 -0000 Message-Id: In-Reply-To: <7afb608c78004321a7e3805fbaf2c62d@git.apache.org> References: <7afb608c78004321a7e3805fbaf2c62d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [12/50] [abbrv] incubator-geode git commit: GEODE-871: build-up of sockets in TIME_WAIT on locator machine GEODE-871: build-up of sockets in TIME_WAIT on locator machine This change-set alters the client to abort its TCP/IP connection to the locator by enabling SO_LINGER and setting the timeout to zero before it closes the connection. The Locator closes its connection first, which puts it into TIME_WAIT. The client then aborts the connection, which cleans up the Locator's TIME_WAIT connection. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/c01506b2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/c01506b2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/c01506b2 Branch: refs/heads/feature/GEODE-773-2 Commit: c01506b27e233538ecc2ca5a81ca113c15cc388a Parents: 8a8571f Author: Bruce Schuchardt Authored: Thu Jan 28 08:31:19 2016 -0800 Committer: Bruce Schuchardt Committed: Thu Jan 28 08:33:13 2016 -0800 ---------------------------------------------------------------------- .../distributed/internal/tcpserver/TcpClient.java | 8 +++++--- .../distributed/internal/tcpserver/TcpServer.java | 17 +---------------- 2 files changed, 6 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c01506b2/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java index 47f50b3..836416b 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpClient.java @@ -167,14 +167,15 @@ public class TcpClient { } return null; } finally { - if (out != null) { - out.close(); - } try { + sock.setSoLinger(true, 0); // initiate an abort on close to shut down the locator's socket sock.close(); } catch(Exception e) { logger.error("Error closing socket ", e); } + if (out != null) { + out.close(); + } } } @@ -223,6 +224,7 @@ public class TcpClient { } } finally { try { + sock.setSoLinger(true, 0); // initiate an abort on close to shut down the server's socket sock.close(); } catch(Exception e) { logger.error("Error closing socket ", e); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/c01506b2/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java index f52b9ab..e5ad416 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/distributed/internal/tcpserver/TcpServer.java @@ -398,7 +398,6 @@ public class TcpServer { DataSerializer.writeObject(response, output); output.flush(); - output.close(); } handler.endResponse(request,startTime); @@ -467,24 +466,10 @@ public class TcpServer { t.printStackTrace(); } } finally { - // Normal path closes input first, so let's do that here... - if (input != null) { - try { - input.close(); - } catch (IOException e) { - log.warn( - "Exception closing input stream", e); - } - } - - // Closing the ObjectInputStream is supposed to close - // the underlying InputStream, but we do it here just for - // good measure. Closing a closed socket is a no-op. try { sock.close(); } catch (IOException e) { - log.warn( - "Exception closing socket", e); + // ignore } } }