aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime
diff options
context:
space:
mode:
authorGravatar Eric Fellheimer <felly@google.com>2015-02-19 19:22:08 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-02-19 19:22:08 +0000
commitaff6fd76d644317f6813e464db57d5640e588378 (patch)
tree9206a203cd9005c2ab81b192ff528edfafc06bb2 /src/main/java/com/google/devtools/build/lib/runtime
parent48746df8da52002e7c8b5286a04421295b6302ab (diff)
Fix shutdown deadlock when a shutdown hook crashes - halt() instead of exit().
See associated bug for more details. -- MOS_MIGRATED_REVID=86708715
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/BugReport.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/BugReport.java b/src/main/java/com/google/devtools/build/lib/runtime/BugReport.java
index ee1e429ac0..9c67eef959 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/BugReport.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/BugReport.java
@@ -81,7 +81,11 @@ public abstract class BugReport {
// We don't call runtime#shutDown() here because all it does is shut down the modules, and who
// knows if they can be trusted.
}
- System.exit(exitCode);
+ // Avoid shutdown deadlock issues: If an application shutdown hook crashes, it will trigger our
+ // Blaze crash handler (this method). Calling System#exit() here, would therefore induce a
+ // deadlock. This call would block on the shutdown sequence completing, but the shutdown
+ // sequence would in turn be blocked on this thread finishing. Instead, exit fast via halt().
+ Runtime.getRuntime().halt(exitCode);
}
private static void printThrowableTo(OutErr outErr, Throwable e) {