This is an automated email from the ASF dual-hosted git repository.
imbajin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hugegraph.git
The following commit(s) were added to refs/heads/master by this push:
new 817887dcc fix(docker): supervise Java process in entrypoints instead
of tail -f /dev/null (#3051)
817887dcc is described below
commit 817887dcce88395dc04342fb9be3a38cf1f86191
Author: KAI <[email protected]>
AuthorDate: Mon Jun 8 08:44:19 2026 +0530
fix(docker): supervise Java process in entrypoints instead of tail -f
/dev/null (#3051)
Problem: all three docker-entrypoint.sh files used tail -f /dev/null to
keep the container alive. When Java crashed, tail kept running and the
container stayed up with no Java inside — Docker restart policy never fired.
Verified locally: kill -9 Java inside running container -> container
exits -> Docker restarts it automatically (tested 3 times for server,
PD restart loop confirmed for pd).
---
hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh | 3 +--
hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh | 7 ++++++-
hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh | 3 +--
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh
b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh
index d1ae5c3c3..529936d06 100755
--- a/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh
+++ b/hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh
@@ -82,5 +82,4 @@ log " pd.initial-store-list=${HG_PD_INITIAL_STORE_LIST}"
log " pd.initial-store-count=${HG_PD_INITIAL_STORE_COUNT}"
log " pd.data-path=${HG_PD_DATA_PATH}"
-./bin/start-hugegraph-pd.sh -j "${JAVA_OPTS:-}"
-tail -f /dev/null
+./bin/start-hugegraph-pd.sh -d false -j "${JAVA_OPTS:-}"
diff --git a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh
b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh
index 779c3eb70..2c76a5443 100755
--- a/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh
+++ b/hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh
@@ -91,4 +91,9 @@ if [[ "${ACTUAL_BACKEND}" == "hstore" ]]; then
./bin/wait-partition.sh || log "WARN: partitions not assigned yet"
fi
-tail -f /dev/null
+PID=$(cat ./bin/pid 2>/dev/null || true)
+if [[ -n "$PID" ]]; then
+ trap 'kill -TERM "$PID" 2>/dev/null; while kill -0 "$PID" 2>/dev/null; do
sleep 1; done; exit 0' TERM INT
+ tail --pid="$PID" -f /dev/null
+ exit 1
+fi
diff --git a/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh
b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh
index 1bdaaafc5..8ea9022a3 100755
--- a/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh
+++ b/hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh
@@ -77,5 +77,4 @@ log " raft.address=${HG_STORE_RAFT_ADDRESS}"
log " server.port=${HG_STORE_REST_PORT}"
log " app.data-path=${HG_STORE_DATA_PATH}"
-./bin/start-hugegraph-store.sh -j "${JAVA_OPTS:-}"
-tail -f /dev/null
+./bin/start-hugegraph-store.sh -d false -j "${JAVA_OPTS:-}"