Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions hugegraph-pd/hg-pd-dist/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:-}"
7 changes: 6 additions & 1 deletion hugegraph-server/hugegraph-dist/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Forward shutdown to HugeGraphServer

Evidence: PD and Store now execute their foreground scripts with -d false, but the server entrypoint still starts start-hugegraph.sh in daemon mode and then blocks on tail --pid="$PID" -f /dev/null at this line. Docker sends SIGTERM to PID 1, so this shell/tail path can exit without signaling the Java PID; the server then waits for Docker's forced kill instead of a graceful shutdown.

Please add a TERM/INT trap that kills and waits for $PID, or otherwise run the server foreground path after the post-start checks, so docker stop shuts HugeGraphServer down cleanly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch added a TERM/INT trap before the tail --pid block in f20b8a4:

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

When dumb-init forwards SIGTERM from docker stop, the trap fires: sends SIGTERM to Java, polls with kill -0 until Java exits cleanly, then exits 0. The tail --pid crash-detection path still exits 1 so restart policy fires on a crash.

exit 1
fi
3 changes: 1 addition & 2 deletions hugegraph-store/hg-store-dist/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:-}"
Loading