Skip to content

Commit eff64a2

Browse files
committed
amqp_channel: Adapt channel_exit handling
... after `rabbit_writer` conversion to gen_server. [Why] The `rabbit_writer` being a regular gen_server now, it will stop with the reason `{shutdown, Reason}`. Otherwise this would be considered a crash by the supervision tree and it would log even more scary errors and stacktraces. [How] If the reason is `{shutdown, _}`, we just unpack the embedded reason and use it for the channel stop reason. This ensures the behavior of the channel process doesn't change.
1 parent 7849f14 commit eff64a2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

deps/amqp_client/src/amqp_channel.erl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,11 @@ handle_channel_exit(Reason = #amqp_error{name = ErrorName, explanation = Expl},
839839
handle_shutdown({connection_closing, ReportedReason}, State);
840840
handle_channel_exit(Reason, State) ->
841841
%% Unexpected death of a channel infrastructure process
842-
{stop, {infrastructure_died, Reason}, State}.
842+
Reason1 = case Reason of
843+
{shutdown, R} -> R;
844+
_ -> Reason
845+
end,
846+
{stop, {infrastructure_died, Reason1}, State}.
843847

844848
handle_shutdown({_, 200, _}, State) ->
845849
{stop, normal, State};

0 commit comments

Comments
 (0)