You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
setTimeout callback is executed sooner than it should in docker on Mac OS #26155
The timeout interval that is set cannot be relied upon to execute after that exact number of milliseconds. /* ... */ The only guarantee is that the timeout will not execute sooner than the declared timeout interval
Ok, timeout should not be executed sooner than the declared timeout interval.
However, after several script executions (it was 8th attempt) I got the following confusing result:
Docker somehow slews (compresses) the monotonic system time used for timers.
The real-time clock (what new Date() uses) drifts inside the docker instance.
Either way, I suspect this isn't actually a Node.js bug but behavior that can also be observed with e.g. a python script or a C program.
It's possible that Node.js is more likely to trigger it as it prefers CLOCK_MONOTONIC_COARSE (when it's available and granular enough) to the more common CLOCK_MONOTONIC.
We can update the documentation by adding the link to this issue. I really didn't expect that this might happen.
Now:
The only guarantee is that the timeout will not execute sooner than the declared timeout interval.
Suggestion:
The only guarantee is that the timeout will not execute sooner than the declared timeout interval (there is an <link>issue</link> inside docker container on Mac OS).
We don't usually list third-party software bugs in our documentation. Have you checked if there's an open docker bug about this? If not, it might be worthwhile to report it over there.
Activity
bnoordhuis commentedon Feb 17, 2019
There could be one of two things going on here:
new Date()uses) drifts inside the docker instance.Either way, I suspect this isn't actually a Node.js bug but behavior that can also be observed with e.g. a python script or a C program.
It's possible that Node.js is more likely to trigger it as it prefers
CLOCK_MONOTONIC_COARSE(when it's available and granular enough) to the more commonCLOCK_MONOTONIC.Jokero commentedon Feb 18, 2019
We can update the documentation by adding the link to this issue. I really didn't expect that this might happen.
Now:
Suggestion:
bnoordhuis commentedon Feb 18, 2019
We don't usually list third-party software bugs in our documentation. Have you checked if there's an open docker bug about this? If not, it might be worthwhile to report it over there.
gireeshpunathil commentedon Jan 6, 2020
excerpts from the connected issue:
closing this based on the above, not an issue with node.js