This is an automated email from the ASF dual-hosted git repository.
popduke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bifromq.git
The following commit(s) were added to refs/heads/main by this push:
new 1a6e3078 Expose heap dump dir via a dedicated env(defaults to log_dir)
(#173)
1a6e3078 is described below
commit 1a6e3078eed82d8ae1c3e34d45500149419ca12a
Author: yuanyang <[email protected]>
AuthorDate: Fri Aug 29 12:01:09 2025 +0800
Expose heap dump dir via a dedicated env(defaults to log_dir) (#173)
---
build/build-bifromq-starter/bin/bifromq-start.bat | 9 ++++++++-
build/build-bifromq-starter/bin/bifromq-start.sh | 8 +++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/build/build-bifromq-starter/bin/bifromq-start.bat
b/build/build-bifromq-starter/bin/bifromq-start.bat
index 072b042f..d5b01116 100644
--- a/build/build-bifromq-starter/bin/bifromq-start.bat
+++ b/build/build-bifromq-starter/bin/bifromq-start.bat
@@ -60,6 +60,13 @@ if not exist "%LOG_DIR%" (
mkdir "%LOG_DIR%"
)
+rem Heap dump directory to use
+if "" == "%HEAP_DUMP_DIR%" set HEAP_DUMP_DIR=%LOG_DIR%
+rem create heap dump directory
+if not exist "%HEAP_DUMP_DIR%" (
+ mkdir "%HEAP_DUMP_DIR%"
+)
+
rem data directory to use
if "" == "%DATA_DIR%" set DATA_DIR=%BASE_DIR%\data
rem create data directory
@@ -131,7 +138,7 @@ if "" == "%JVM_GC_OPTS%" (
'-XX:+UseZGC' ^
'-XX:ZAllocationSpikeTolerance=5' ^
'-XX:+HeapDumpOnOutOfMemoryError' ^
- '-XX:HeapDumpPath="%LOG_DIR%"' ^
+ '-XX:HeapDumpPath=%HEAP_DUMP_DIR%' ^
'-Xlog:async' ^
'-Xlog:gc:file="%LOG_DIR%\gc.log:time,tid,tags:filecount=5,filesize=50m"'
)
diff --git a/build/build-bifromq-starter/bin/bifromq-start.sh
b/build/build-bifromq-starter/bin/bifromq-start.sh
index 24df48d1..e7fb2f12 100755
--- a/build/build-bifromq-starter/bin/bifromq-start.sh
+++ b/build/build-bifromq-starter/bin/bifromq-start.sh
@@ -64,6 +64,12 @@ if [ "x$LOG_DIR" = "x" ]; then
fi
mkdir -p "$LOG_DIR"
+# Heap dump directory to use, default is log directory
+if [ "x$HEAP_DUMP_DIR" = "x" ]; then
+ HEAP_DUMP_DIR="$LOG_DIR"
+fi
+mkdir -p "$HEAP_DUMP_DIR"
+
# Data directory to use
if [ "x$DATA_DIR" = "x" ]; then
DATA_DIR="$BASE_DIR/data"
@@ -156,7 +162,7 @@ if [ -z "$JVM_GC_OPTS" ]; then
-Xlog:gc:file='${LOG_DIR}/gc-%t.log:time,tid,tags:filecount=5,filesize=50m' \
-XX:+CrashOnOutOfMemoryError \
-XX:+HeapDumpOnOutOfMemoryError \
- -XX:HeapDumpPath='${LOG_DIR}' \
+ -XX:HeapDumpPath=${HEAP_DUMP_DIR} \
"
fi