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

Igor Ribeiro Sucupira <>
Wed May 21 22:29:52 CEST 2008


I don't know the reason for the delay, but you shouldn't be trying to
monitor something that does not exist.

>From the man pages:
"When a process is monitored by registered name, the process that has
the registered name at the time when erlang:monitor/2 is called will
be monitored. The monitor will not be effected, if the registered name
is unregistered."

Igor.

On Wed, May 14, 2008 at 9:30 PM, Scott Lystig Fritchie
<> wrote:
> 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



More information about the erlang-questions mailing list