[erlang-questions] what is trap_exit business, process_flag(trap_exit, true)
db
masterofquestions@REDACTED
Thu Apr 24 03:21:41 CEST 2008
In my gen_server:init function, I spawn client processes onto remote
nodes using proc_lib:spawn_link(N, M, F, A). Before I spawn any
process on to remote nodes, I have placed process_flag(trap_exit,
true). But when I do exit kill/shutdown in the shell, my gen_server
and all the remote client processes are terminated mercilessly. I
thought process_flag(trap_exit, true) supposed to prevent the whole
thing from crashing. Are these kill/shutdown type of exits trappable
or only 'EXIT'?
(b@REDACTED)8> exit(pid(0,147,0)).
** exception exit: <0.147.0>
in function exit/1
called as exit(<0.147.0>)
(b@REDACTED)9> exit(pid(0,147,0), kill).
true
(b@REDACTED)10> exit(pid(0,182,0), shutdown).
true
(a@REDACTED)9>
=ERROR REPORT==== 23-Apr-2008::19:54:52 ===
** Generic server clnt_sup terminating
** Last message in was {'EXIT',<5679.182.0>,shutdown}
** When Server state == {ets_pid,{clnt,loop,[<0.6396.0>]}}
** Reason for termination ==
** {'module could not be loaded',[{ets_pid,tab2list,[]},
{clnt_sup,terminate,2},
{gen_server,terminate,6},
{proc_lib,init_p,5}]}
Thank you,
hoping to get some answers from erlang mailing list, people in IRC are
very helpful.
--
rk
That which we persist in doing becomes easier for us to do; not that
the nature of the thing itself is changed, but that our power to do is
increased.
-Ralph Waldo Emerson
More information about the erlang-questions
mailing list