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:
Michael Klishin 2017-05-11 18:11:48 +03:00
parent 69591877bd
commit 0ed56a70b8
3 changed files with 7 additions and 2 deletions

View File

@ -78,6 +78,8 @@ handle_message({'DOWN', _MRef, process, _ConnSup, shutdown}, State) ->
{stop, {shutdown, node_down}, State};
handle_message({'DOWN', _MRef, process, _ConnSup, 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) ->
{stop, {unexpected_msg, Msg}, State}.

View File

@ -230,8 +230,9 @@ handle_info({'EXIT', BlockHandler, Reason},
"Reason: ~p~n", [self(), BlockHandler, Reason]),
erlang:demonitor(Ref, [flush]),
{noreply, State#state{block_handler = none}};
handle_info({'EXIT', _Pid, _Reason}, State) ->
{noreply, State};
%% propagate the exit to the module that will stop with a sensible reason logged
handle_info({'EXIT', _Pid, _Reason} = Info, State) ->
callback(handle_message, [Info], State);
handle_info(Info, State) ->
callback(handle_message, [Info], State).

View File

@ -73,6 +73,8 @@ handle_message(heartbeat_timeout, State) ->
{stop, heartbeat_timeout, State};
handle_message(closing_timeout, State = #state{closing_reason = Reason}) ->
{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
handle_message({Ref, {error, Reason}},
State = #state{waiting_socket_close = Waiting,