[erlang-questions] OTP question

Alpár Jüttner <>
Mon Aug 18 10:14:13 CEST 2008


Hi,

> In test_ser.erl, trap exits:

Many thanks.

Should I set this for the servers only, or the sub-supervisors, too?
What is the reason why this isn't the default setting?

Best regards,
Alpar
> 
> init([]) ->
>     erlang:process_flag(trap_exit, true),
>     io:format("TEST SERVER INIT.~n",[]),
>     {ok, []}.
> 
> Hope this helps,
> Edwin
> 
> 2008/8/17 Alpár Jüttner <>
>         Hi,
>         
>         I have a fairly basic problem, probably I did a silly mistake.
>         When I
>         stop an application, it does not terminate the supervisor
>         tree. Please
>         find an example in the attachment. It is a minimal application
>         with one
>         supervisor and a server. When I start the application, the
>         supervisor
>         and the server starts nicely:
>         
>                $erl
>                Erlang (BEAM) emulator version 5.6.3 [source] [smp:2]
>                [async-threads:0] [hipe] [kernel-poll:false]
>         
>                Eshell V5.6.3  (abort with ^G)
>                1> c(test_ser).
>                {ok,test_ser}
>                2> c(test_sup).
>                {ok,test_sup}
>                3> c(test_app).
>                {ok,test_app}
>                4> application:start(test_app).
>                TEST APP START.
>                TEST SUPERVISOR START LINK.
>                TEST SUPERVISOR INIT.
>                TEST SERVER START LINK.
>                TEST SERVER INIT.
>                ok
>         
>         But when I stop it, test_app:stop/1 is executed, but
>         test_sup:terminate/1 and test_server:terminate/2 are not.
>         
>                5> application:stop(test_app).
>                TEST APP STOP.
>         
>                =INFO REPORT==== 17-Aug-2008::22:27:49 ===
>                    application: test_app
>                    exited: stopped
>                    type: temporary
>                ok
>                6>
>         
>         What do I do wrong?
>         
>         Best regards,
>         Alpar
>         
>         
>         _______________________________________________
>         erlang-questions mailing list
>         
>         http://www.erlang.org/mailman/listinfo/erlang-questions
> 
> 
> 
> -- 
> For every expert there is an equal and opposite expert - Arthur C.
> Clarke
> 




More information about the erlang-questions mailing list