feat: log error if timed out waiting after init:stop
This commit is contained in:
parent
668ecbe97b
commit
f1262e04bf
|
@ -41,7 +41,8 @@ start_link() ->
|
|||
|
||||
is_running() -> is_pid(whereis(?TERMINATOR)).
|
||||
|
||||
%% @doc Call terminator to stop applications, then issue init:stop() to terminat the VM.
|
||||
%% @doc Call `emqx_machine_terminator' to stop applications
|
||||
%% then call init:stop() stop beam.
|
||||
graceful() ->
|
||||
try
|
||||
_ = gen_server:call(?TERMINATOR, ?DO_IT, infinity)
|
||||
|
|
15
bin/emqx
15
bin/emqx
|
@ -480,14 +480,19 @@ case "$1" in
|
|||
# Wait for the node to completely stop...
|
||||
PID="$(relx_get_pid)"
|
||||
if ! relx_nodetool "stop"; then
|
||||
echoerr "emqx_graceful_shutdown_failed PID=[$PID]"
|
||||
echoerr "Graceful shutdown failed PID=[$PID]"
|
||||
exit 1
|
||||
fi
|
||||
WAIT_TIME=30
|
||||
WAIT_TIME="${WAIT_FOR_ERLANG_STOP:-60}"
|
||||
if ! wait_for "$WAIT_TIME" is_down "$PID"; then
|
||||
echoerr "emqx_pid_dangling_after ${WAIT_TIME} seconds PID=[$PID]"
|
||||
msg="dangling after ${WAIT_TIME} seconds"
|
||||
# also log to syslog
|
||||
logger -t "${REL_NAME}[${PID}]" "STOP: $msg"
|
||||
# log to user console
|
||||
echoerr "STOP: $msg"
|
||||
exit 1
|
||||
fi
|
||||
logger -t "${REL_NAME}[${PID}]" "STOP: OK"
|
||||
;;
|
||||
|
||||
restart|reboot)
|
||||
|
@ -612,7 +617,7 @@ case "$1" in
|
|||
$RELX_CONFIG_PATH $CONFIG_ARGS $EPMD_ARG
|
||||
|
||||
# Log the startup
|
||||
logger -t "${REL_NAME}[$$]" "$* -- ${1+$ARGS}"
|
||||
logger -t "${REL_NAME}[$$]" "EXEC: $* -- ${1+$ARGS}"
|
||||
|
||||
# Start the VM
|
||||
exec "$@" -- ${1+$ARGS}
|
||||
|
@ -653,7 +658,7 @@ case "$1" in
|
|||
$RELX_CONFIG_PATH $CONFIG_ARGS $EPMD_ARG
|
||||
|
||||
# Log the startup
|
||||
logger -t "${REL_NAME}[$$]" "$* -- ${1+$ARGS}"
|
||||
logger -t "${REL_NAME}[$$]" "EXEC: $* -- ${1+$ARGS}"
|
||||
|
||||
# Start the VM
|
||||
exec "$@" -- ${1+$ARGS}
|
||||
|
|
Loading…
Reference in New Issue