krestenkrab / hanoidb

Erlang LSM BTree Storage
Apache License 2.0
307 stars 58 forks source link

hanoidb crashes on exit when started by open_link #32

Open brigadier opened 10 years ago

brigadier commented 10 years ago

When hanoidb is started supervised like

init([]) ->
    RestartStrategy = one_for_one,
    MaxRestarts = 1,
    MaxSecondsBetweenRestarts = 10,
    SupFlags = {RestartStrategy, MaxRestarts, MaxSecondsBetweenRestarts},

    Restart = transient,
    Shutdown = 2000,
    Type = worker,

    AChild = {hanoidb, {hanoidb, open_link, [{local, hanoi_process}, "somedir.hanoi", []]},
                Restart, Shutdown, Type, [hanoidb]},

    {ok, {SupFlags, [AChild]}}

it crashes when application getting stopped by q() with

[error] Undefined:Undefined   crash: exit:shutdown [{plain_fsm,parent_EXIT,2,[{file,"src/plain_fsm.erl"},{line,508}]},{hanoidb_level,initialize,1,[{file,"src/hanoidb_level.erl"},{line,156}]},{proc_lib,init_p,3,[{file,"proc_lib.erl"},{line,222}]}]

error. There's no error if it gets stopped with hanoidb:close(hanoi_process). prior to q().

I think supervised processes should stop gracefully without manual actions.

krestenkrab commented 9 years ago

Feel free to enlighten me as to how this should best be fixed.