trap_exit with gen_server?
Shawn Pearce
spearce@REDACTED
Mon Mar 3 07:09:28 CET 2003
Ok, this is an odd one for me. I thought that setting
process_flag(trap_exit, true), would allow my gen_server
module to receive the {'EXIT',Pid,Reason} message from
the handle_info/2 callback.
Apparently on line 412 of gen_server.erl in RB9-0 the
gen_server behavior now traps the exit messages and calls
terminate. So linked processes will always take down my
gen_server.
Line 52 of gen_server.erl seems to indicate that handle_info/2
can be used to receive exit messages from linked processes without
the gen_server crashing. :)
I guess I shouldn't link to my gen_server unless I want the
gen_server to crash when the linked processes crash. :)
Since this is in an OTP supervision tree, and I'm using
erlang:monitor/2 now to watch processes, so this behavior is
ok, but not expected.
--
Shawn.
Do what comes naturally. Seethe and fume and throw a tantrum.
More information about the erlang-questions
mailing list