You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2025/08/04 01:59:01 UTC

(asterixdb) 01/05: [NO ISSUE][HYR][MISC] Allow a custom logger for thread dump at halt

This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 9c02ec70f210e213eef3af73345ec3b7d54b2b62
Author: Michael Blow <mi...@couchbase.com>
AuthorDate: Sat Jul 19 11:24:19 2025 -0400

    [NO ISSUE][HYR][MISC] Allow a custom logger for thread dump at halt
    
    Ext-ref: MB-67719
    Change-Id: I412a13187ed4fcc25fe8283427d92b4a6af8b35d
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20123
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Michael Blow <mb...@apache.org>
    Reviewed-by: Hussain Towaileb <hu...@gmail.com>
---
 .../src/main/java/org/apache/hyracks/util/ExitUtil.java        | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
index 7eb9fd4f8a..11ef6192a1 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
@@ -100,18 +100,18 @@ public class ExitUtil {
     }
 
     public static void halt(int status) {
-        halt(status, Level.FATAL);
+        halt(status, Level.FATAL, LOGGER);
     }
 
-    public static synchronized void halt(int status, Level logLevel) {
+    public static synchronized void halt(int status, Level logLevel, Logger threadDumpLogger) {
         try {
             boolean interrupted = Thread.interrupted();
             LOGGER.log(logLevel, "JVM halting with status {} (halting thread {}, interrupted {})", status,
                     Thread.currentThread(), interrupted);
             Future<?> future = haltThreadDumpExecutor.submit(() -> {
-                LOGGER.log(logLevel, "Thread dump at halt: {}", ThreadDumpUtil.takeDumpString());
-                // try to give time for the log to be emitted...
-                LogManager.shutdown();
+                threadDumpLogger.log(logLevel, "Thread dump at halt: {}", ThreadDumpUtil.takeDumpString());
+                // try to give time for the log to be emitted by asking the log manager to shut down...
+                LogManager.shutdown(false, true);
             });
             future.get(HALT_THREADDUMP_TIMEOUT_SECONDS, TimeUnit.SECONDS);
         } catch (Exception e) {