ERTS timeouts don't account for computer suspension

Guilherme Andrade g@REDACTED
Sun May 10 21:19:55 CEST 2020


Hello list,

I've recently run into an unexpected behaviour of erlcron[1] - it doesn't
account for any time period the computer spends suspended - scheduled
events get delayed by equal amounts.

This is because it leverages gen_server timeouts which, in turn, use
bog-standard VM timeouts, which behave in the way I described. I've
confirmed[2] their behaviour by comparing time elapsed until timeout
according to erlang:monotonic_time/1 vs. os:system_time/1.

After delving into the Erlang/OTP source code for a while I realized there
are two configuration options[3] that appear to control the unexpected
behaviour: "--enable-prefer-elapsed-monotonic-time-during-suspend" and
"--disable-prefer-elapsed-monotonic-time-during-suspend",
introduced[4] in OTP 18.0.2.

The default value of the setting configured by either of those two options
is "no"[5] - that is, elapsed monotonic time during suspend is not prefered.

I would like to know the rationale for this. Is it for:
- performance reasons? (say, because it's faster and server hardware rarely
suspends, if at all)
- intended behaviour? (contrary to my expectations)

I'd be thankful for your thoughts on this matter and whether you think the
default behaviour should be changed.

[1]: https://github.com/erlware/erlcron
[2]: https://gist.github.com/g-andrade/508c779a931dde14c22c6e96319caa24
[3]:
http://erlang.org/documentation/doc-10.5/doc/installation_guide/INSTALL.html#configuring
[4]:
https://github.com/erlang/otp/commit/4a864c1cbe16a42f3f5190881187e3c9849e985f
[5]:
https://github.com/erlang/otp/blob/OTP-22.3.4/erts/aclocal.m4#L2355-L2358
<https://github.com/erlang/otp/blob/OTP-22.3.4/erts/aclocal.m4#L2355-L2358>

-- 
Guilherme
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200510/7d571043/attachment.htm>


More information about the erlang-questions mailing list