Terminating application during startup

Gunilla Arendt gunilla@REDACTED
Wed Mar 22 10:42:47 CET 2006


Hi,

This bug is fixed in OTP R11B.

I'm not quite sure what you mean with "terminating nicely". If you mean
that you want the node to survive even if an application fails to start,
set the type of the application to transient in the .rel file.

Regards, Gunilla

Fredrik Thulin wrote:
> Hi
> 
> I have a problem with getting my application to terminate nicely when an 
> error occurs during startup. I have done some serious testing here and 
> discovered that the problem is with reason strings longer than exactly 
> 30 characters.
> 
> The problem can be seem with the attached example application, compiled 
> like this :
> 
>   $ /pkg/erlang/R10B-10/bin/erlc my.erl
>   $ /pkg/erlang/R10B-10/bin/erlc my.rel
> 
> Booting 'my' with '-extra short' works (meaning the erlang VM 
> terminates), '-extra long' gives an ugly error message and the erlang 
> VM never terminates!
> 
> 
> $ /pkg/erlang/R10B-10/bin/erl -boot my -noshell -extra short
> 
> =INFO REPORT==== 21-Mar-2006::14:48:14 ===
>     application: my
>     exited: {"123456789012345678901234567890",{my,start,[normal,[foo]]}}
>     type: permanent
> {"Kernel pid 
> terminated",application_controller,"{application_start_failure,my,
> {[49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54,55,56,57,48],
> {my,start,[normal,[foo]]}}}"}
> 
> Crash dump was written to: erl_crash.dump
> Kernel pid terminated (application_controller) 
> ({application_start_failure,my,
> {[49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54,55,56,57,48],
> {my,start,[normal,[foo]]}}})
> 
> $ /pkg/erlang/R10B-10/bin/erl -boot my -noshell -extra long
> 
> =INFO REPORT==== 21-Mar-2006::14:48:19 ===
>     application: my
>     exited: {"1234567890123456789012345678901",{my,start,[normal,
> [foo]]}}
>     type: permanent
> {"Kernel pid 
> terminated",application_controller,"{application_start_failure,my,
> {[49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54,55,56,57,48,49],
> {my,start,[normal,[foo]]}}}"}
> {error_logger,{{2006,3,21},{14,48,21}},'~s~n',['Error in process <0.0.0> 
> with exit value: {badarg,[{erlang,halt,["Kernel pid terminated 
> (application_controller) ({application_start_failure,my,
> {[49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54,55,56,57,48,49,50,51,52,53,54,55,56,57,48,49],
> {m... \n']}
> 
> 
> /Fredrik
> 
> PS. Does anyone have alternate suggestions about how to get your 
> application to terminate on startup problems? The '-extra short' output 
> isn't very appealing either with the big "Kernel pid terminated" tuple 
> outputted. I'd rather not have an erl_crash.dump file written for all 
> occasions either. Non-zero exit-status is necessary.



More information about the erlang-questions mailing list