Repository: cassandra Updated Branches: refs/heads/cassandra-3.0 de86ab1bb -> 19245e5fa refs/heads/cassandra-3.9 6a846e6f8 -> 02f48c865 refs/heads/trunk 8f4698065 -> 21bde4c20
Fix potential resource leak in RMIServerSocketFactoryImpl patch by Arunkumar M; reviewed by yukim for CASSANDRA-12331 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/19245e5f Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/19245e5f Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/19245e5f Branch: refs/heads/cassandra-3.0 Commit: 19245e5faccdd4c1b926e94c38b7a7faad005453 Parents: de86ab1 Author: arunkumar-m <arunkumar.0...@gmail.com> Authored: Thu Aug 4 08:48:49 2016 -0700 Committer: Yuki Morishita <yu...@apache.org> Committed: Thu Aug 11 11:01:32 2016 -0500 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../cassandra/utils/RMIServerSocketFactoryImpl.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/19245e5f/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 3db2c77..0a1d406 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 3.0.9 + * Fix potential resource leak in RMIServerSocketFactoryImpl (CASSANDRA-12331) * Backport CASSANDRA-12002 (CASSANDRA-12177) * Make sure compaction stats are updated when compaction is interrupted (CASSANDRA-12100) * Fix potential bad messaging service message for paged range reads http://git-wip-us.apache.org/repos/asf/cassandra/blob/19245e5f/src/java/org/apache/cassandra/utils/RMIServerSocketFactoryImpl.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/RMIServerSocketFactoryImpl.java b/src/java/org/apache/cassandra/utils/RMIServerSocketFactoryImpl.java index 6d4ff72..6444a65 100644 --- a/src/java/org/apache/cassandra/utils/RMIServerSocketFactoryImpl.java +++ b/src/java/org/apache/cassandra/utils/RMIServerSocketFactoryImpl.java @@ -23,6 +23,7 @@ package org.apache.cassandra.utils; import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; +import java.net.SocketException; import java.rmi.server.RMIServerSocketFactory; import javax.net.ServerSocketFactory; @@ -34,8 +35,16 @@ public class RMIServerSocketFactoryImpl implements RMIServerSocketFactory { ServerSocket socket = ServerSocketFactory.getDefault() .createServerSocket(pPort, 0, InetAddress.getLoopbackAddress()); - socket.setReuseAddress(true); - return socket; + try + { + socket.setReuseAddress(true); + return socket; + } + catch (SocketException e) + { + socket.close(); + throw e; + } } public boolean equals(Object obj)