[erlang-questions] How to debug handle_info EXIT message?

Robert Virding robert.virding@REDACTED
Fri Apr 27 11:32:47 CEST 2012


The message is sent to gen_server because it was trapping exits and was linked to the other process. This message comes from the exit signal the other process (automatically) sent out when it died*. So it no longer exists and it is impossible to do process_info on it.

*As the gen_server is trapping exits then all exit signals which it receives are automatically converted into messages which it can 'receive' in the normal manner. The gen_server behaviour receives the message, recognises it as something recognise and so calls handle_info/2 to allow the callback module to process it. N.B. exist signals are NOT messages, it is trapping exists which converts them to messages.

Robert

----- Original Message -----
> The puzzling thing is that this message appears 1-2 sec after the
> start
> of the gen_server without any further interaction with it. At the end
> of
> Module:init/1 function I try to print information about this process:
> 
> process_info(list_to_pid("<0.2637.0>"))
> 
> but returns 'undefined'.
> 
> On 4/25/2012 11:42 AM, Ladislav Lenart wrote:
> > Hello.
> >
> > The process <0.2637.0> terminated with reason 'normal'. Your
> > gen_server process
> > received the 'EXIT' message because:
> >  * <0.2637.0> and your gen_server were linked together AND
> >  * your gen_server is trapping exits, i.e. it invoked
> >  process_flag(trap_exit,
> > true) in its init/1.
> >
> > See also the following documentation:
> >  * process_flag/2 -
> >  http://www.erlang.org/doc/man/erlang.html#process_flag-2
> >  * spawn_link/1 -
> >  http://www.erlang.org/doc/man/erlang.html#spawn_link-1
> >  * link/1 - http://www.erlang.org/doc/man/erlang.html#link-1
> >
> >
> > HTH,
> >
> > Ladislav Lenart
> >
> >
> > On 25.4.2012 09:49, Martin Dimitrov wrote:
> >> Hello,
> >>
> >> I receive in a module implementing gen_server behavior in the
> >> function
> >> handle_info/2 the following message:
> >>
> >> {'EXIT',<0.2637.0>,normal}
> >>
> >> What is the reason to receive this message? The process <0.2637.0>
> >> was
> >> spawned by this gen_server and then died? Is it possible to get
> >> more
> >> information about this process after it has died since
> >> process_info/1
> >> returns undefined?
> >>
> >> Thank you very much for looking at this.
> >>
> >> Best Regards,
> >>
> >> Martin
> >> _______________________________________________
> >> erlang-questions mailing list
> >> erlang-questions@REDACTED
> >> http://erlang.org/mailman/listinfo/erlang-questions
> >>
> >
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
> 



More information about the erlang-questions mailing list