diff options
author | Dan Gudmundsson <[email protected]> | 2011-10-27 11:01:36 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2011-11-07 14:19:34 +0100 |
commit | 567a8276de0b146bfcbf6e81626d11694ca8edf8 (patch) | |
tree | 73774f1038567949c3bfd77c5b7cc2e9f3f291e6 /lib/mnesia/src | |
parent | f561a98a9b89738467b52ab5213562de753f6ad2 (diff) | |
download | otp-567a8276de0b146bfcbf6e81626d11694ca8edf8.tar.gz otp-567a8276de0b146bfcbf6e81626d11694ca8edf8.tar.bz2 otp-567a8276de0b146bfcbf6e81626d11694ca8edf8.zip |
[mnesia] Cleanly bring down mnesia
Aviods failing/wobbling testcase. Mnesia mishandled supervisors.
Diffstat (limited to 'lib/mnesia/src')
-rw-r--r-- | lib/mnesia/src/mnesia_event.erl | 6 | ||||
-rw-r--r-- | lib/mnesia/src/mnesia_monitor.erl | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/mnesia/src/mnesia_event.erl b/lib/mnesia/src/mnesia_event.erl index ec6b99ecaa..5a060a28ff 100644 --- a/lib/mnesia/src/mnesia_event.erl +++ b/lib/mnesia/src/mnesia_event.erl @@ -121,7 +121,7 @@ handle_system_event({mnesia_up, Node}, State) -> {ok, State#state{nodes = Nodes}}; handle_system_event({mnesia_down, Node}, State) -> - case mnesia:system_info(fallback_activated) of + case mnesia:system_info(fallback_activated) andalso Node =/= node() of true -> case mnesia_monitor:get_env(fallback_error_function) of {mnesia, lkill} -> @@ -129,8 +129,8 @@ handle_system_event({mnesia_down, Node}, State) -> "must be restarted. Forcing shutdown " "after mnesia_down from ~p...~n", report_fatal(Msg, [Node], nocore, State#state.dumped_core), - mnesia:lkill(), - exit(fatal); + catch exit(whereis(mnesia_monitor), fatal), + {ok, State}; {UserMod, UserFunc} -> Msg = "Warning: A fallback is installed and Mnesia got mnesia_down " "from ~p. ~n", diff --git a/lib/mnesia/src/mnesia_monitor.erl b/lib/mnesia/src/mnesia_monitor.erl index e110ad3241..8cb2e92c08 100644 --- a/lib/mnesia/src/mnesia_monitor.erl +++ b/lib/mnesia/src/mnesia_monitor.erl @@ -536,7 +536,11 @@ handle_info({'EXIT', Pid, R}, State) when Pid == State#state.supervisor -> handle_info({'EXIT', Pid, fatal}, State) when node(Pid) == node() -> dbg_out("~p got FATAL ERROR from: ~p~n",[?MODULE, Pid]), - exit(State#state.supervisor, shutdown), + %% This may hang supervisor if a shutdown happens at the same time as an fatal + %% is in progress + %% exit(State#state.supervisor, shutdown), + %% It is better to kill an innocent process + catch exit(whereis(mnesia_locker), kill), {noreply, State}; handle_info(Msg = {'EXIT',Pid,_}, State) -> |