Skip to content

Commit 91ec75f

Browse files
committed
rabbit_msg_store: log a warning when GC kill fallback fires
The `exit(GCPid, shutdown)` signal is expected to terminate the GC immediately because the GC does not trap exits. If it does not, the fallback `exit(GCPid, kill)` path runs silently and the operator has no visibility into a case that should, by design, never happen. Emit a warning on the fallback path identifying the store directory and the timeout that expired. This makes the fallback searchable in fleet-wide logs so we can tell whether the bounded-wait was ever actually needed in production. Thread the `Dir` argument back into `stop_gc/2` for the log message.
1 parent 2a548bf commit 91ec75f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

deps/rabbit/src/rabbit_msg_store.erl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ terminate(Reason, State = #msstate { index_ets = IndexEts,
987987
%% mid-callback on disk I/O. Bound the wait so terminate stays within
988988
%% the msg_store child's own supervisor shutdown timeout, and fall
989989
%% back to kill if the shutdown signal does not take effect in time.
990-
stop_gc(GCPid),
990+
stop_gc(GCPid, Dir),
991991
State3 = case CurHdl of
992992
undefined -> State;
993993
_ -> State2 = internal_sync(State),
@@ -1022,7 +1022,7 @@ code_change(_OldVsn, State, _Extra) ->
10221022

10231023
format_message_queue(Opt, MQ) -> rabbit_misc:format_message_queue(Opt, MQ).
10241024

1025-
stop_gc(GCPid) ->
1025+
stop_gc(GCPid, Dir) ->
10261026
ShutdownTimeout = rabbit_misc:get_env(
10271027
rabbit, msg_store_shutdown_timeout, 600_000),
10281028
Timeout = max(ShutdownTimeout - 60_000, 5_000),
@@ -1031,6 +1031,9 @@ stop_gc(GCPid) ->
10311031
receive
10321032
{'DOWN', MRef, process, GCPid, _} -> ok
10331033
after Timeout ->
1034+
?LOG_WARNING("Message store GC for directory '~ts' did not exit "
1035+
"within ~bms of shutdown signal, killing it",
1036+
[Dir, Timeout]),
10341037
exit(GCPid, kill),
10351038
receive
10361039
{'DOWN', MRef, process, GCPid, _} -> ok

0 commit comments

Comments
 (0)