Cleanup MessagingService socket after catching Throwable (ninja #11841)
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/77924b37 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/77924b37 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/77924b37 Branch: refs/heads/trunk Commit: 77924b37c9bd28af8bfdc77edc9c7d6717c8085d Parents: b39d984 Author: Paulo Motta <pauloricard...@gmail.com> Authored: Mon Aug 15 17:19:38 2016 -0300 Committer: Yuki Morishita <yu...@apache.org> Committed: Wed Aug 31 16:04:32 2016 -0500 ---------------------------------------------------------------------- .../org/apache/cassandra/net/IncomingStreamingConnection.java | 5 ++--- src/java/org/apache/cassandra/net/MessagingService.java | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/77924b37/src/java/org/apache/cassandra/net/IncomingStreamingConnection.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/net/IncomingStreamingConnection.java b/src/java/org/apache/cassandra/net/IncomingStreamingConnection.java index ab262c7..f7dc240 100644 --- a/src/java/org/apache/cassandra/net/IncomingStreamingConnection.java +++ b/src/java/org/apache/cassandra/net/IncomingStreamingConnection.java @@ -74,10 +74,9 @@ public class IncomingStreamingConnection extends Thread implements Closeable // parallelize said streams and the socket is blocking, so we might deadlock. StreamResultFuture.initReceivingSide(init.sessionIndex, init.planId, init.description, init.from, this, init.isForOutgoing, version, init.keepSSTableLevel, init.isIncremental); } - catch (IOException e) + catch (Throwable t) { - logger.error(String.format("IOException while reading from socket from %s, closing: %s", - socket.getRemoteSocketAddress(), e)); + logger.error("Error while reading from socket from {}.", socket.getRemoteSocketAddress(), t); close(); } } http://git-wip-us.apache.org/repos/asf/cassandra/blob/77924b37/src/java/org/apache/cassandra/net/MessagingService.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/net/MessagingService.java b/src/java/org/apache/cassandra/net/MessagingService.java index 8c8a333..fb0c9ca 100644 --- a/src/java/org/apache/cassandra/net/MessagingService.java +++ b/src/java/org/apache/cassandra/net/MessagingService.java @@ -1034,9 +1034,9 @@ public final class MessagingService implements MessagingServiceMBean logger.error("SSL handshake error for inbound connection from " + socket, e); FileUtils.closeQuietly(socket); } - catch (IOException e) + catch (Throwable t) { - logger.trace("Error reading the socket " + socket, e); + logger.trace("Error reading the socket {}", socket, t); FileUtils.closeQuietly(socket); } }