[erlang-questions] gen_event and global event handlers

Gunilla Arendt gunilla@REDACTED
Fri Mar 30 09:36:39 CEST 2007


The only difference between a "global" event manager and a "local"
event manager is that your process in one case is registered globally,
and in the other case is registered locally. So, if the event manager
works fine locally, it should work fine globally.

The exit reason noproc means "no such process". That is, your event
manager has terminated somewhere between the calls to
gen_event:which_handlers/1 and gen_event:add_handler/3.

Since you use gen_event:start_link/1 to start your event manager, and
assuming you start it from the shell, my first guess is that you have
accidently killed your shell process. Since it is linked to
the event manager, this process will terminate as well.

Starting the SASL application will install an event handler in
error_logger that gives more information about gen_* process
terminations. Use
  % erl -boot start_sasl
or
  1> application:start(sasl).

Good luck,
/ Gunilla


jm wrote:
> And the any notes floating around on the specifics of global event
> managers? I have an event mananager and a set of handler that work fine
> as locally, but when I attempt to make a couple of simple changes for it
> to work across two machines/nodes thing start to go awry.
> 
> To begin with execute the following all on the same node with EVENTMGR
> to equal some atom,
> 
>   gen_event:start_link({global, ?EVENTMGR}).
> 
>   gen_event:which_handlers({global,?EVENTMGR}).
> 
> returns []. Then in calling event handler module executes
> 
>   start_link(Options) ->
>     gen_event:add_handler({global, ?EVENTMGR}, ?MODULE, Options).
> 
> 
> called with Options = []. Yet calling this function results in
> 
> ** exited: noproc **
> 
> and
> 
>   gen_event:which_handlers({global,?EVENTMGR}).
> 
> now also returns
> 
> ** exited: noproc **
> 
> Any hints as to what may be going wrong?
> 
> Jeff.




More information about the erlang-questions mailing list