[erlang-questions] application:stop(mnesia) blocking

Colm Dougan <>
Wed Jan 28 23:34:47 CET 2009


On Tue, Jan 27, 2009 at 6:03 PM, Colm Dougan <> wrote:
> Hi list,
>
> I've got a strange problem with mnesia:stop that is driving me nuts.
> I'm sure it must be something trivial I've done wrong but I can't seem
> to figure it out.  I have a trivial application called "foo" which
> contains a gen_server called foo_main.  The gen_server does an
> application:start(mnesia) in its init callback and an
> application:stop(mnesia) in the terminate callback.   For some reason
> the latter seems to block until it eventually gets killed by the
> supervisor.
>
> I'd be very grateful if someone could look at my code and point out
> the inevitably dumb thing I'm doing wrong :
>
>    http://github.com/gardenia/sandbox/tree/de2b36089f1d7928de3161fe7f9d6b78f0b840bd/mnesia_hang_on_shutdown

I decided to try and rule out mnesia and so I tried using crypto
insteand and got exactly the same behavior.  Is there some inherent
problem with doing application:stop(something) in a gen_server
terminate?  Where is the correct place to stop applications like
crypto/mnesia when following OTP principles?

Thanks,
Colm



More information about the erlang-questions mailing list