Skip to content

Commit

Permalink
Make sure rabbit_misc:pmap callbacks do not throw.
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
hairyhum committed Jan 24, 2018
1 parent affb941 commit 189a452
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/rabbit_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,29 @@ emit_info(PidList, InfoItems, Ref, AggregatorPid) ->

refresh_config_local() ->
rabbit_misc:upmap(
fun (C) -> gen_server2:call(C, refresh_config, infinity) end,
fun (C) ->
try
gen_server2:call(C, refresh_config, infinity)
catch _:Reason ->
rabbit_log:error("Failed to refresh channel config "
"for channel ~p. Reason ~p",
[C, Reason])
end
end,
list_local()),
ok.

refresh_interceptors() ->
rabbit_misc:upmap(
fun (C) -> gen_server2:call(C, refresh_interceptors, ?REFRESH_TIMEOUT) end,
fun (C) ->
try
gen_server2:call(C, refresh_interceptors, ?REFRESH_TIMEOUT)
catch _:Reason ->
rabbit_log:error("Failed to refresh channel interceptors "
"for channel ~p. Reason ~p",
[C, Reason])
end
end,
list_local()),
ok.

Expand Down

0 comments on commit 189a452

Please sign in to comment.