<p>Mnesia:stop sends a call message to the application process to stop. That process is busy shutting down your application and thus a deadlock happens. </p>
<div class="gmail_quote">On Apr 29, 2011 6:50 AM, "Chris Hicks" <<a href="mailto:silent_vendetta@hotmail.com">silent_vendetta@hotmail.com</a>> wrote:<br type="attribution">> <br>> I forgot to mention that if I comment out mnesia:stop() from the stop function of the app so that it looks like this:<br>
> stop(_State) -> %% mnesia:stop(),       ok.<br>> the app shuts down perfectly fine. I can then enter mnesia:stop() into the console and it will immediately shut down as if nothing is wrong. The freezing up only happens when I try to call mnesia:stop() (or application:stop(mnesia)) from within the applications stop function.<br>
> From: <a href="mailto:silent_vendetta@hotmail.com">silent_vendetta@hotmail.com</a><br>> To: <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>> Date: Thu, 28 Apr 2011 20:35:36 -0700<br>
> Subject: [erlang-questions] Can't shut down Mnesia from within application<br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> Hello all,<br>> I've got an application which, in it's start function, calls mnesia:start() before starting the top level supervisor. The only thing I'm doing with Mnesia at the moment is working with a single ram-copies table. In the stop function of the same application I call mnesia:stop(). At that point I shouldn't have any transactions or anything going on, but Mnesia simply hangs and I can't do anything but shut the Erlang VM down and restart it again. Any ideas what might be going on or where I should look?<br>
> Chris Hicks.                                         <br>> <br>> _______________________________________________<br>> erlang-questions mailing list<br>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>                                          <br></div>