Delegate generic EXIT handling to implementation modules
The catch-all-and-ignore clause resulted in connections not actually dying when they were expected to, wrecking havoc to some RabbitMQ server test suites. Per discussion with @dcorbacho. This amends #79.
This commit is contained in:
parent
69591877bd
commit
0ed56a70b8
|
|
@ -78,6 +78,8 @@ handle_message({'DOWN', _MRef, process, _ConnSup, shutdown}, State) ->
|
||||||
{stop, {shutdown, node_down}, State};
|
{stop, {shutdown, node_down}, State};
|
||||||
handle_message({'DOWN', _MRef, process, _ConnSup, Reason}, State) ->
|
handle_message({'DOWN', _MRef, process, _ConnSup, Reason}, State) ->
|
||||||
{stop, {remote_node_down, Reason}, State};
|
{stop, {remote_node_down, Reason}, State};
|
||||||
|
handle_message({'EXIT', Pid, Reason}, State) ->
|
||||||
|
{stop, rabbit_misc:format("stopping because dependent process ~p died: ~p", [Pid, Reason]), State};
|
||||||
handle_message(Msg, State) ->
|
handle_message(Msg, State) ->
|
||||||
{stop, {unexpected_msg, Msg}, State}.
|
{stop, {unexpected_msg, Msg}, State}.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -230,8 +230,9 @@ handle_info({'EXIT', BlockHandler, Reason},
|
||||||
"Reason: ~p~n", [self(), BlockHandler, Reason]),
|
"Reason: ~p~n", [self(), BlockHandler, Reason]),
|
||||||
erlang:demonitor(Ref, [flush]),
|
erlang:demonitor(Ref, [flush]),
|
||||||
{noreply, State#state{block_handler = none}};
|
{noreply, State#state{block_handler = none}};
|
||||||
handle_info({'EXIT', _Pid, _Reason}, State) ->
|
%% propagate the exit to the module that will stop with a sensible reason logged
|
||||||
{noreply, State};
|
handle_info({'EXIT', _Pid, _Reason} = Info, State) ->
|
||||||
|
callback(handle_message, [Info], State);
|
||||||
handle_info(Info, State) ->
|
handle_info(Info, State) ->
|
||||||
callback(handle_message, [Info], State).
|
callback(handle_message, [Info], State).
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,8 @@ handle_message(heartbeat_timeout, State) ->
|
||||||
{stop, heartbeat_timeout, State};
|
{stop, heartbeat_timeout, State};
|
||||||
handle_message(closing_timeout, State = #state{closing_reason = Reason}) ->
|
handle_message(closing_timeout, State = #state{closing_reason = Reason}) ->
|
||||||
{stop, Reason, State};
|
{stop, Reason, State};
|
||||||
|
handle_message({'EXIT', Pid, Reason}, State) ->
|
||||||
|
{stop, rabbit_misc:format("stopping because dependent process ~p died: ~p", [Pid, Reason]), State};
|
||||||
%% see http://erlang.org/pipermail/erlang-bugs/2012-June/002933.html
|
%% see http://erlang.org/pipermail/erlang-bugs/2012-June/002933.html
|
||||||
handle_message({Ref, {error, Reason}},
|
handle_message({Ref, {error, Reason}},
|
||||||
State = #state{waiting_socket_close = Waiting,
|
State = #state{waiting_socket_close = Waiting,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue