geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [12/50] [abbrv] incubator-geode git commit: GEODE-871: build-up of sockets in TIME_WAIT on locator machine
Date Mon, 01 Feb 2016 20:55:29 GMT
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 <bschuchardt@pivotal.io>
Authored: Thu Jan 28 08:31:19 2016 -0800
Committer: Bruce Schuchardt <bschuchardt@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
           }
         }
       }


Mime
View raw message