You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/01/29 02:16:58 UTC
[41/52] [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-831
Commit: c01506b27e233538ecc2ca5a81ca113c15cc388a
Parents: 8a8571f
Author: Bruce Schuchardt <bs...@pivotal.io>
Authored: Thu Jan 28 08:31:19 2016 -0800
Committer: Bruce Schuchardt <bs...@pivotal.io>
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
}
}
}