[erlang-questions] terminating a gen_server

Anthony Shipman als@REDACTED
Tue Sep 11 17:31:34 CEST 2007

On Tuesday 11 September 2007 09:32, Chandru wrote:
> On 10/09/2007, Anthony Shipman <als@REDACTED> wrote:
> > I've found that I can do exit(Pid, shutdown) where Pid is a gen_server
> > and it will nicely shut down, calling Mod:terminate.
> >
> > I can't see how this works. The server is not trapping exit signals so I
> > would expect it to just exit without calling Mod:terminate.
> >
> > The code in gen_server:loop seems to be deliberately written to support
> > this behaviour. Can we rely on it?
> This should not be possible. Can you post your code? If not, what
> version of erlang are you using? The Mod:terminate function should
> only be called if the gen_server is trapping exits. According to the
> gen_server documentation;

This appears to be a false alarm. A trap_exit has crept in to my server so it 
must be the cause of it working. I can't reproduce it without the trap_exit. 
Anthony Shipman                    Mamas don't let your babies 
als@REDACTED                   grow up to be outsourced.

More information about the erlang-questions mailing list