[erlang-questions] gen_server & trap_exit

Roberto Ostinelli roberto@REDACTED
Sat Apr 9 14:27:47 CEST 2011

Dear list,

I start a gen_server and in the initialization i set process_flag(trap_exit,
true), obviously to allow the gen_server to catch child processes crashes.

Whenever i start this gen_server from the shell and then issue an error in
the shell, the gen_server exits too:

** exception error: undefined shell command abc/0

=ERROR REPORT==== 9-Apr-2011::14:16:51 ===
** Generic server testserver terminating
** Last message in was {'EXIT',<0.272.0>,

I believe that this behavior of the server exiting because its parent exits
is supposed to happen, since trap_exit doesn't let the gen_server trap its
parent process exiting. What I believe happens is that the shell 'crashes'
and so does the child process 'testserver'.

Am I correct in my assumptions, or am I missing a fundamental point here?

Thank you,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110409/2f1bb9b7/attachment.htm>

More information about the erlang-questions mailing list