[erlang-questions] erlang:monitor() lag time: how long to expect?

Ulf Wiger <>
Sun May 18 11:48:00 CEST 2008


I can't say much about the delay. It seems surprisingly long,
if it isn't because the communication times out.

But using monitor on a process that hasn't been started yet
is perfectly valid, and shouldn't cause any weird effects.

BR,
Ulf W

2008/5/15 Scott Lystig Fritchie <>:
> Hi, I've discovered that the lag time between calling erlang:monitor()
> and receiving the {'DOWN', ...} message.  I'd like to ask how long is
> reasonable to wait?
>
> The proc I'm monitoring is on a remote node, and I'm monitoring it via
> erlang:monitor(process, {registered_name_atom(), node_atom()}).  I have
> two Erlang nodes, A & B, on two separate physical machines.  Both are
> running R11B-5 on top of Linux, "erl -kernel net_ticktime 60 ...".
>
>   1. B is quite busy doing stuff, but it's responding to
>      gen_server:call() queries within the default 5 seconds.
>
>   2. On A, I call monitor/2 for a process, my_server_proc, that hasn't
>      started yet on B.
>
>   3. 31 seconds later, B starts & registers the proc I want to monitor
>
>   4. 32 seconds later, A gets a {'DOWN', ...} message for step #2's
>      monitor.
>
> I suppose I shouldn't be monitoring a proc that hasn't been started
> yet.  ("Doctor, it hurts when ...")  And there's a work-around, I
> suppose: use rpc:call(node_B, erlang, whereis, [my_server_proc]) to
> verify that the server is actually running.
>
> Has anyone else run into seemingly long-delayed {'DOWN', ...} messages?
>
> -Scott
>
> --- snip --- snip --- snip --- snip --- snip --- snip ---
>
> node A : 20080514162806 : make_monitor 1: {my_server_proc,''} ref #Ref<0.0.0.247945>
>
> node B : 20080514162837 : progress: [{supervisor,{local,foo_foo_sup}},{started,[{pid,<0.324.0>},{name,my_server_proc},{mfa,{foo_server,start_link,...
>
> node A : 20080514162857 : gen_server:call({my_server_proc,''}, bar) returned ok
>
> node A : 20080514162909 : got 'DOWN': my_server_proc Mref #Ref<0.0.0.247945>, Type process, Object {my_server_proc,''}, Info noproc
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list