[erlang-patches] [patch] fix excessive CPU consumption of timer_server

Aliaksey Kandratsenka alkondratenko@REDACTED
Tue Apr 9 21:27:49 CEST 2013


On Tue, Apr 9, 2013 at 3:00 AM, Björn Gustavsson <bgustavsson@REDACTED>wrote:

>
> On Mon, Apr 8, 2013 at 4:55 PM, Aliaksey Kandratsenka <
> alkondratenko@REDACTED> wrote:
>>
>>
>> If we use erlang:now and time jumps backwards. We'll have time as seen by
>> receive X -> X after AfterMillis -> ok end flow normally, but erlang:now
>> will crawl. Which can be seen to cause same busy wait in timer server but
>> just for much longer (i.e. until erlang:now overtakes os:timestamp where
>> that "never go back" code path stops being hit and time flows normal again).
>>
>>
> That should not happen.
>
> Time correction means that the time returned by erlang:now/0
> (and most other time functions) will move one per cent slower
> or faster until the correct wall-clock time has been reached. The
> time used internally by 'receive after' will also use the corrected time.
>
> We have been thinking about documenting the time
> correction mechanism in one place, describing how it works and listing all
> time functions and whether they used the corrected time or not.
>

Thanks for pointing this out. Indeed I don't know how I managed but I
misread the code.

I've updated patch to use erlang:now instead of os:timestamp.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130409/a57ce51a/attachment.htm>


More information about the erlang-patches mailing list