Skip to content

Commit 04f0b13

Browse files
committed
Make sure rabbit_misc:pmap callbacks do not throw.
rabbit_misc:pmap/2 can hang if a callback throws an error. This can cause plugin startup to hang when enabling channel interceptors. Made it log errors and continue. [#153846585]
1 parent 0b1417d commit 04f0b13

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/rabbit_channel.erl

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,29 @@ emit_info(PidList, InfoItems, Ref, AggregatorPid) ->
361361

362362
refresh_config_local() ->
363363
rabbit_misc:upmap(
364-
fun (C) -> gen_server2:call(C, refresh_config, infinity) end,
364+
fun (C) ->
365+
try
366+
gen_server2:call(C, refresh_config, infinity)
367+
catch _:Reason ->
368+
rabbit_log:error("Failed to refresh channel config "
369+
"for channel ~p. Reason ~p",
370+
[C, Reason])
371+
end
372+
end,
365373
list_local()),
366374
ok.
367375

368376
refresh_interceptors() ->
369377
rabbit_misc:upmap(
370-
fun (C) -> gen_server2:call(C, refresh_interceptors, ?REFRESH_TIMEOUT) end,
378+
fun (C) ->
379+
try
380+
gen_server2:call(C, refresh_interceptors, ?REFRESH_TIMEOUT)
381+
catch _:Reason ->
382+
rabbit_log:error("Failed to refresh channel interceptors "
383+
"for channel ~p. Reason ~p",
384+
[C, Reason])
385+
end
386+
end,
371387
list_local()),
372388
ok.
373389

0 commit comments

Comments
 (0)