cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yu...@apache.org
Subject [09/12] cassandra git commit: Fix unreleased resource sockets
Date Thu, 20 Oct 2016 14:48:30 GMT
Fix unreleased resource sockets

patch by Arunkumar M; reviewed by yukim for CASSANDRA-12330


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/83cc2ed3
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/83cc2ed3
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/83cc2ed3

Branch: refs/heads/cassandra-3.X
Commit: 83cc2ed3af284c8d82bd80e27bf9f7848f0b1548
Parents: 86a73d4
Author: Arunkumar M <arunkumar.0190@gmail.com>
Authored: Thu Aug 11 22:34:14 2016 -0700
Committer: Yuki Morishita <yukim@apache.org>
Committed: Thu Oct 20 09:46:55 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                              |  2 +-
 .../cassandra/streaming/DefaultConnectionFactory.java    | 11 ++++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/83cc2ed3/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ec32945..82348d5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,5 @@
 3.0.10
- * Fix potential socket leak (CASSANDRA-12329)
+ * Fix potential socket leak (CASSANDRA-12329, CASSANDRA-12330)
  * Fix ViewTest.testCompaction (CASSANDRA-12789)
  * Improve avg aggregate functions (CASSANDRA-12417)
  * Preserve quoted reserved keyword column names in MV creation (CASSANDRA-11803)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/83cc2ed3/src/java/org/apache/cassandra/streaming/DefaultConnectionFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/streaming/DefaultConnectionFactory.java b/src/java/org/apache/cassandra/streaming/DefaultConnectionFactory.java
index 5c27ff3..77ee0f1 100644
--- a/src/java/org/apache/cassandra/streaming/DefaultConnectionFactory.java
+++ b/src/java/org/apache/cassandra/streaming/DefaultConnectionFactory.java
@@ -47,15 +47,24 @@ public class DefaultConnectionFactory implements StreamConnectionFactory
         int attempts = 0;
         while (true)
         {
+            Socket socket = null;
             try
             {
-                Socket socket = OutboundTcpConnectionPool.newSocket(peer);
+                socket = OutboundTcpConnectionPool.newSocket(peer);
                 socket.setSoTimeout(DatabaseDescriptor.getStreamingSocketTimeout());
                 socket.setKeepAlive(true);
                 return socket;
             }
             catch (IOException e)
             {
+                if (socket != null)
+                {
+                    try
+                    {
+                        socket.close();
+                    }
+                    catch (IOException ignore) {}
+                }
                 if (++attempts >= MAX_CONNECT_ATTEMPTS)
                     throw e;
 


Mime
View raw message