[NO ISSUE] Log the threaddump of the NC at shutdown
To assist in debugging issues that may have triggered a shutdown, info
log the node's thread dump at the start of a shutdown request.
Change-Id: I55adc38ca9c66b1e75486f0e9715e1d475917ee6
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2042
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCShutdownHook.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCShutdownHook.java
index 1cd45b2..0a02635 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCShutdownHook.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/NCShutdownHook.java
@@ -21,6 +21,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.apache.hyracks.util.ThreadDumpUtil;
+
/**
* Shutdown hook that invokes {@link NodeControllerService#stop() stop} method.
* This shutdown hook must have a failsafe mechanism to halt the process in case the shutdown
@@ -67,6 +69,7 @@
}
shutdownHookThread = Thread.currentThread();
watchDog.start();
+ LOGGER.log(Level.INFO, () -> "Thread dump at shutdown: " + ThreadDumpUtil.takeDumpString());
nodeControllerService.stop();
} catch (Throwable th) { // NOSONAR... This is fine since this is shutdown hook
LOGGER.log(Level.WARNING, "Exception in executing shutdown hook", th);