[erlang-questions] question on 'EXIT' messages delivered to exit-trapping gen_servers

Adam Kocoloski adam.kocoloski@REDACTED
Fri Apr 3 01:06:58 CEST 2009


Hi Erlangers, I've been doing a little hacking on CouchDB and running  
into some behavior that I don't understand.  We have a standalone  
gen_server (let's call it A) that traps exits and was started by  
another gen_server (B) using start_link.  B does not trap exits, and  
is linked to some other process C.  Now we have the following sequence  
of events:

* exit(C, kill)
* B exits immediately with Reason killed
* A calls terminate with Reason killed

That last line surprised me.  I was expecting to receive {'EXIT', B,  
killed} in A's mailbox, and in fact I had written a handle_info to  
process all 'EXIT' messages, but none arrived.  I checked that  
trap_exit is still true in A's terminate.  {trap_exit, true} clearly  
has some effect, as without it terminate isn't even called.

I tried changing the exit signal to some other atom, but I still get  
the same basic results (just with goodbye_cruel_world instead of kill/ 
killed in the Reasons).  I'm stumped.  Regards, Adam



More information about the erlang-questions mailing list