cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/3] git commit: Move System.exit on OOM into a separate thread patch by jbellis; reviewed by marcuse for CASSANDRA-5273
Date Wed, 22 May 2013 15:33:26 GMT
Updated Branches:
  refs/heads/cassandra-1.2 de2ee6e28 -> bf28e8d4b
  refs/heads/trunk bac41da61 -> 44827b4a8


Move System.exit on OOM into a separate thread
patch by jbellis; reviewed by marcuse for CASSANDRA-5273


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

Branch: refs/heads/cassandra-1.2
Commit: bf28e8d4b84afd5f9821ad965274768b8d4ca179
Parents: de2ee6e
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Wed May 22 10:32:36 2013 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Wed May 22 10:33:09 2013 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 +
 .../apache/cassandra/service/CassandraDaemon.java  |   12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/bf28e8d4/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 3902dec..21faf5a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 1.2.6
+ * Move System.exit on OOM into a separate thread (CASSANDRA-5273)
  * Write row markers when serializing schema (CASSANDRA-5572)
  * Check only SSTables for the requested range when streaming (CASSANDRA-5569)
  * Improve batchlog replay behavior and hint ttl handling (CASSANDRA-5314)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/bf28e8d4/src/java/org/apache/cassandra/service/CassandraDaemon.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CassandraDaemon.java b/src/java/org/apache/cassandra/service/CassandraDaemon.java
index 40c453d..343d497 100644
--- a/src/java/org/apache/cassandra/service/CassandraDaemon.java
+++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java
@@ -58,6 +58,16 @@ public class CassandraDaemon
         initLog4j();
     }
 
+    // Have a dedicated thread to call exit to avoid deadlock in the case where the thread
that wants to invoke exit
+    // belongs to an executor that our shutdown hook wants to wait to exit gracefully. See
CASSANDRA-5273.
+    private static final Thread exitThread = new Thread(new Runnable()
+    {
+        public void run()
+        {
+            System.exit(100);
+        }
+    }, "Exit invoker");
+
     /**
      * Initialize logging in such a way that it checks for config changes every 10 seconds.
      */
@@ -178,7 +188,7 @@ public class CassandraDaemon
                 {
                     // some code, like FileChannel.map, will wrap an OutOfMemoryError in
another exception
                     if (e2 instanceof OutOfMemoryError)
-                        System.exit(100);
+                        exitThread.start();
 
                     if (e2 instanceof FSError)
                     {


Mime
View raw message