This is an automated email from the ASF dual-hosted git repository.
corgy pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 2c563f8d1e [Improve][Core] Auto-create GC log directory to avoid
startup failures (#10255)
2c563f8d1e is described below
commit 2c563f8d1e6d2415ced341d5992cf0403dbf9e21
Author: Jast <[email protected]>
AuthorDate: Sun Jan 4 20:48:52 2026 +0800
[Improve][Core] Auto-create GC log directory to avoid startup failures
(#10255)
---
config/jvm_options | 12 ++++++++++++
.../seatunnel-starter/src/main/bin/seatunnel-cluster.cmd | 13 +++++++++++++
.../seatunnel-starter/src/main/bin/seatunnel-cluster.sh | 14 ++++++++++++++
.../seatunnel-starter/src/main/bin/seatunnel.cmd | 13 +++++++++++++
seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.sh | 14 ++++++++++++++
5 files changed, 66 insertions(+)
diff --git a/config/jvm_options b/config/jvm_options
index d435a7d275..0e5d289ea0 100644
--- a/config/jvm_options
+++ b/config/jvm_options
@@ -28,3 +28,15 @@
# G1GC
-XX:+UseG1GC
+
+# GC Logging
+# Uncomment the following options to enable GC logging for troubleshooting and
performance analysis.
+# The GC log directory will be automatically created on startup if it doesn't
exist.
+# -XX:+PrintGCDetails
+# -XX:+PrintGCDateStamps
+# -XX:+PrintGCTimeStamps
+# -Xloggc:/tmp/seatunnel/gc/gc.log
+# -XX:+UseGCLogFileRotation
+# -XX:NumberOfGCLogFiles=10
+# -XX:GCLogFileSize=200M
+# -XX:+PrintGCApplicationStoppedTime
diff --git
a/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.cmd
b/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.cmd
index f07b561119..cd17ce43e5 100644
--- a/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.cmd
+++ b/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.cmd
@@ -134,6 +134,19 @@ if defined HEAP_DUMP_PATH (
if defined HEAP_DUMP_DIR if not exist "!HEAP_DUMP_DIR!" mkdir
"!HEAP_DUMP_DIR!"
)
+REM Ensure Xloggc directory exists to avoid GC logging failures.
+set "GC_LOG_PATH="
+for %%I in (!JAVA_OPTS!) do (
+ set "opt=%%I"
+ if "!opt:~0,8!"=="-Xloggc:" (
+ set "GC_LOG_PATH=!opt:~8!"
+ )
+)
+if defined GC_LOG_PATH (
+ for %%D in ("!GC_LOG_PATH!") do set "GC_LOG_DIR=%%~dpD"
+ if defined GC_LOG_DIR if not exist "!GC_LOG_DIR!" mkdir "!GC_LOG_DIR!"
+)
+
IF NOT EXIST "%HAZELCAST_CONFIG%" (
echo Error: File %HAZELCAST_CONFIG% does not exist.
exit /b 1
diff --git a/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh
b/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh
index 3a372967dd..8eff7127fa 100755
--- a/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh
+++ b/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel-cluster.sh
@@ -172,6 +172,20 @@ if [[ -n "$HEAP_DUMP_PATH" ]]; then
fi
fi
+# Ensure Xloggc directory exists to avoid GC logging failures.
+GC_LOG_PATH=""
+for opt in $JAVA_OPTS; do
+ if [[ "$opt" == -Xloggc:* ]]; then
+ GC_LOG_PATH="${opt#-Xloggc:}"
+ fi
+done
+if [[ -n "$GC_LOG_PATH" ]]; then
+ GC_LOG_DIR="$(dirname "$GC_LOG_PATH")"
+ if [[ -n "$GC_LOG_DIR" && ! -d "$GC_LOG_DIR" ]]; then
+ mkdir -p "$GC_LOG_DIR"
+ fi
+fi
+
CLASS_PATH=${APP_DIR}/lib/*:${APP_JAR}
echo "start ${NODE_ROLE} node"
diff --git a/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.cmd
b/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.cmd
index 6225f6e41f..2522e6be78 100644
--- a/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.cmd
+++ b/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.cmd
@@ -136,4 +136,17 @@ if defined HEAP_DUMP_PATH (
if defined HEAP_DUMP_DIR if not exist "!HEAP_DUMP_DIR!" mkdir
"!HEAP_DUMP_DIR!"
)
+REM Ensure Xloggc directory exists to avoid GC logging failures.
+set "GC_LOG_PATH="
+for %%I in (!JAVA_OPTS!) do (
+ set "opt=%%I"
+ if "!opt:~0,8!"=="-Xloggc:" (
+ set "GC_LOG_PATH=!opt:~8!"
+ )
+)
+if defined GC_LOG_PATH (
+ for %%D in ("!GC_LOG_PATH!") do set "GC_LOG_DIR=%%~dpD"
+ if defined GC_LOG_DIR if not exist "!GC_LOG_DIR!" mkdir "!GC_LOG_DIR!"
+)
+
java !JAVA_OPTS! -cp %CLASS_PATH% %APP_MAIN% %args%
diff --git a/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.sh
b/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.sh
index 5ad3462da6..f8337c8b82 100755
--- a/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.sh
+++ b/seatunnel-core/seatunnel-starter/src/main/bin/seatunnel.sh
@@ -133,4 +133,18 @@ if [[ -n "$HEAP_DUMP_PATH" ]]; then
fi
fi
+# Ensure Xloggc directory exists to avoid GC logging failures.
+GC_LOG_PATH=""
+for opt in $JAVA_OPTS; do
+ if [[ "$opt" == -Xloggc:* ]]; then
+ GC_LOG_PATH="${opt#-Xloggc:}"
+ fi
+done
+if [[ -n "$GC_LOG_PATH" ]]; then
+ GC_LOG_DIR="$(dirname "$GC_LOG_PATH")"
+ if [[ -n "$GC_LOG_DIR" && ! -d "$GC_LOG_DIR" ]]; then
+ mkdir -p "$GC_LOG_DIR"
+ fi
+fi
+
java ${JAVA_OPTS} -cp ${CLASS_PATH} ${APP_MAIN} ${args}