imbajin commented on code in PR #3044:
URL: https://github.com/apache/hugegraph/pull/3044#discussion_r3330299172
##########
hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh:
##########
@@ -103,33 +103,36 @@ if [[ $DAEMON == "true" ]]; then
echo "Starting HugeGraphServer in daemon mode..."
"${BIN}"/hugegraph-server.sh "${CONF}/${GREMLIN_SERVER_CONF}"
"${CONF}"/rest-server.properties \
"${OPEN_SECURITY_CHECK}" "${USER_OPTION}" "${GC_OPTION}"
"${OPEN_TELEMETRY}" &
-else
- echo "Starting HugeGraphServer in foreground mode..."
- "${BIN}"/hugegraph-server.sh "${CONF}/${GREMLIN_SERVER_CONF}"
"${CONF}"/rest-server.properties \
- "${OPEN_SECURITY_CHECK}" "${USER_OPTION}" "${GC_OPTION}"
"${OPEN_TELEMETRY}"
-fi
-PID="$!"
-# Write pid to file
-echo "$PID" > "$PID_FILE"
+ PID="$!"
+ # Write pid to file
+ echo "$PID" > "$PID_FILE"
-trap 'kill $PID; exit' SIGHUP SIGINT SIGQUIT SIGTERM
+ trap 'kill $PID; exit' SIGHUP SIGINT SIGQUIT SIGTERM
-wait_for_startup ${PID} 'HugeGraphServer' "$REST_SERVER_URL/graphs"
"${SERVER_STARTUP_TIMEOUT_S}" || {
- if [[ "${STDOUT_MODE:-false}" == "true" ]]; then
- echo "See 'docker logs' for HugeGraphServer log output." >&2
- else
- echo "See $LOGS/hugegraph-server.log for HugeGraphServer log output."
>&2
- fi
- if [[ $DAEMON == "true" ]]; then
+ wait_for_startup ${PID} 'HugeGraphServer' "$REST_SERVER_URL/graphs"
"${SERVER_STARTUP_TIMEOUT_S}" || {
+ if [[ "${STDOUT_MODE:-false}" == "true" ]]; then
+ echo "See 'docker logs' for HugeGraphServer log output." >&2
+ else
+ echo "See $LOGS/hugegraph-server.log for HugeGraphServer log
output." >&2
+ fi
exit 1
+ }
+ disown
+
+ if [ "$OPEN_MONITOR" == "true" ]; then
+ if ! "$BIN"/start-monitor.sh; then
+ echo "Failed to open monitor, please start it manually"
+ fi
+ echo "An HugeGraphServer monitor task has been append to crontab"
fi
-}
-disown
-
-if [ "$OPEN_MONITOR" == "true" ]; then
- if ! "$BIN"/start-monitor.sh; then
- echo "Failed to open monitor, please start it manually"
- fi
- echo "An HugeGraphServer monitor task has been append to crontab"
+else
+ echo "Starting HugeGraphServer in foreground mode..."
+ "${BIN}"/hugegraph-server.sh "${CONF}/${GREMLIN_SERVER_CONF}"
"${CONF}"/rest-server.properties \
+ "${OPEN_SECURITY_CHECK}" "${USER_OPTION}" "${GC_OPTION}"
"${OPEN_TELEMETRY}" &
+ PID="$!"
+ # Write pid to file
+ echo "$PID" > "$PID_FILE"
+ wait $PID
Review Comment:
‼️ **Forward termination signals in foreground mode**
Evidence: the daemon branch installs a trap, but the new foreground branch
backgrounds Java and only waits on `$PID` here. If Docker or systemd sends TERM
to the wrapper, the signal is not forwarded to Java, so shutdown can skip
HugeGraph's graceful path and wait for the supervisor's hard kill. Please
install the same TERM/INT/QUIT/HUP forwarding before `wait $PID`, and cover
that path in `test-start-hugegraph.sh`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]