cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sn...@apache.org
Subject [1/3] cassandra git commit: JDK bug from CASSANDRA-8220 makes drain die early also
Date Mon, 19 Oct 2015 12:59:31 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.0 6977521ad -> cf0c61b8e


JDK bug from CASSANDRA-8220 makes drain die early also

patch by Jeremiah Jordan; reviewed by Robert Stupp for CASSANDRA-10545


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

Branch: refs/heads/cassandra-3.0
Commit: b84ed1176c015552550f30629e240c320a00001b
Parents: 27c8011
Author: Jeremiah Jordan <jeremiah@datastax.com>
Authored: Mon Oct 19 14:56:02 2015 +0200
Committer: Robert Stupp <snazy@snazy.de>
Committed: Mon Oct 19 14:56:02 2015 +0200

----------------------------------------------------------------------
 .../apache/cassandra/net/MessagingService.java  | 30 ++++++++++++++++++--
 1 file changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b84ed117/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 d7825d4..724518c 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -743,7 +743,15 @@ public final class MessagingService implements MessagingServiceMBean
         try
         {
             for (SocketThread th : socketThreads)
-                th.close();
+                try
+                {
+                    th.close();
+                }
+                catch (IOException e)
+                {
+                    // see https://issues.apache.org/jira/browse/CASSANDRA-10545
+                    handleIOException(e);
+                }
         }
         catch (IOException e)
         {
@@ -1013,8 +1021,16 @@ public final class MessagingService implements MessagingServiceMBean
 
         void close() throws IOException
         {
-            logger.debug("Closing accept() thread");
-            server.close();
+            logger.trace("Closing accept() thread");
+            try
+            {
+                server.close();
+            }
+            catch (IOException e)
+            {
+                // see https://issues.apache.org/jira/browse/CASSANDRA-8220
+                handleIOException(e);
+            }
             for (Closeable connection : connections) 
             {
                 connection.close();
@@ -1027,6 +1043,14 @@ public final class MessagingService implements MessagingServiceMBean
         }
     }
 
+    private static void handleIOException(IOException e) throws IOException
+    {
+        // dirty hack for clean shutdown on OSX w/ Java >= 1.8.0_20
+        // see https://bugs.openjdk.java.net/browse/JDK-8050499
+        if (!"Unknown error: 316".equals(e.getMessage()) || !"Mac OS X".equals(System.getProperty("os.name")))
+            throw e;
+    }
+
     public Map<String, Integer> getCommandPendingTasks()
     {
         Map<String, Integer> pendingTasks = new HashMap<String, Integer>();


Mime
View raw message