You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2013/05/22 17:33:27 UTC
[2/3] git commit: Move System.exit on OOM into a separate thread
patch by jbellis; reviewed by marcuse for CASSANDRA-5273
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/trunk
Commit: bf28e8d4b84afd5f9821ad965274768b8d4ca179
Parents: de2ee6e
Author: Jonathan Ellis <jb...@apache.org>
Authored: Wed May 22 10:32:36 2013 -0500
Committer: Jonathan Ellis <jb...@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)
{