Skip to content

Commit 3c599aa

Browse files
Merge pull request #14128 from rabbitmq/mergify/bp/v4.1.x/pr-14123
By @tomyouyou: Avoid a scary log exception when a closing connection runs into an exception during a command writer flush operation (backport #14123)
2 parents 30f12e2 + 3d80af6 commit 3c599aa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

deps/rabbit/src/rabbit_channel.erl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,12 @@ handle_cast(ready_for_close,
637637
{stop, normal, State};
638638

639639
handle_cast(terminate, State = #ch{cfg = #conf{writer_pid = WriterPid}}) ->
640-
ok = rabbit_writer:flush(WriterPid),
640+
try
641+
ok = rabbit_writer:flush(WriterPid)
642+
catch
643+
_Class:Reason ->
644+
rabbit_log:debug("Failed to flush pending writes on a terminating connection, reason: ~tp", [Reason])
645+
end,
641646
{stop, normal, State};
642647

643648
handle_cast({command, #'basic.consume_ok'{consumer_tag = CTag} = Msg},

0 commit comments

Comments
 (0)