[rabbitmq-discuss] Erlang has closed

tsuraan tsuraan at gmail.com
Fri Sep 18 01:09:06 BST 2009

> I think what's happening is that the os_mon:call (from cpu_sup:avg1())
> is errorring out somehow, so its return value is { error, _ } instead
> of a number.  In the local_load function of rabbit_load.erl, where you
> currently have
> _Other -> cpu_sup:avg1()
> it should probably be
> _Other ->
>   case cpu_sup:avg1() of
>     { error, _ } -> 0.0;
>     Value -> Value
>   end
> I really wish erlang gave line numbers in its traces, but the only
> arithmetic line in pick() is LoadAvg * ?FUDGE_FACTOR, and I don't
> think the macro's value is changing :)
> Also, avg1()'s man page says it returns a number, but its spec says an
> integer or an { 'error', any() } pair.  Its timeout is set at
> infinity, so it's not a timeout, but it could be some other error.
> I'll see if I can get that machine to bomb out some more with prints
> for the return value of avg1().

I stand corrected.  It is indeed a timeout; I used the above code, but
in the case of { error, X }, I have a io:format("avg1() gave the value
~p~n", [ X ]), and it's saying timeout.  bizarre.  Anyhow, assuming
that 0.0 is an acceptable way to handle that error, it looks like the
fix works for me.

More information about the rabbitmq-discuss mailing list