[erlang-questions] terminate() not finishing after application:stop()
Gijsbert de Haan
gijsbert_de_haan@REDACTED
Thu Jun 12 00:00:16 CEST 2008
Hi,
My terminate() function is not finishing after application:stop(myapp).
I am wondering if my terminate() function takes too long and is getting
killed before it finishes. I have tried to increase the Shutdown timeout
in the child specification but it seems to have no influence.
The process is started by supervisor:start_child(session_sup, Opts),
session_sup is specified as:
{session_sup,
{supervisor, start_link, [{local, session_sup},?MODULE,[session]]},
permanent,
infinity,
supervisor,
[]
}
And the init that returns the spec for the child is this:
init([Module]) ->
{ok,
{_SupFlags = {simple_one_for_one, ?MAX_RESTART, ?MAX_TIME},
[{undefined,
{Module, start_link, []},
temporary,
2000,
worker,
[]
}]
}
}.
On Tue, 10 Jun 2008 15:45:51 +0200, "Ulf Wiger (TN/EAB)"
<ulf.wiger@REDACTED> said:
>
> Make sure your process is trapping exits.
> If it isn't, the process will die immediately when
> the supervisor calls exit(Pid, shutdown).
>
> BR,
> Ulf W
>
> Gijsbert de Haan skrev:
> > Hi,
> >
> > I have an application that I want to stop. In terminate() of one of the
> > processes I save some state to an xml file (with xmerl:export() and
> > file:write_file()). When this process terminates by itself all is well,
> > and the file is saved.
> > But when I call application:stop(myapp) the call to xmerl:export() (in
> > terminate) never returns and the state is not saved. There are no error
> > reports in the log, just the usual info report about myapp having
> > exited. I have put a try/catch (throw/exit/error) around the
> > xmerl:export() with some io:format() calls but nothing comes out.
> >
> > Anybody have a suggestion?
> > Thanks,
> > Gijsbert
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://www.erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list