[erlang-questions] Re: timer server timeout

Ulf Wiger <>
Mon Apr 26 09:57:26 CEST 2010

johan munk wrote:
> No-one has a view on this?

Yes, indeed, but not always the time to answer questions. :)

I never use the internal timeout in gen_server for anything
much, for this very reason. It can be useful as an inactivity
timeout, but if you really want to get a reliable timeout since
a specific point in time, you have to set a timer. Fortunately,
the timer BIFs are very cheap (don't use the functions in the
timer module; use erlang:send_after/3 or erlang:start_timer/3.)

Ulf W

> On Wed, Apr 21, 2010 at 10:05 PM, johan munk <> wrote:
>> Following the control flow in the gen_server, sys, and timer modules I see
>> this:
>> Calling sys:get_status(timer_server) will "reset" the "after time" in the
>> loop function of gen_server. As the timer server uses that time to get a
>> timeout if no other messages are received, one can potentially cause timers
>> to never trigger.
>> Is this a known issue/feature?
>> /JM

Ulf Wiger
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd



Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.


More information about the erlang-questions mailing list