-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timers: fix refresh did not call active to make the node exit early. #28192
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test does not fail without this change. Are we not able to reliably reproduce an issue that this change addresses?
@Trott The test failed in v13.0.0-pre and master
This should be printed twice. edited: I will change about a valid example during the day, I am too tired. AM4.00... |
f1054f5
to
261530e
Compare
It only prints once for me. Perhaps it is platform and/or environment dependent? |
@Trott I think it has little to do with platform, because this is a 🐛 at the js level. Lines 505 to 544 in 43a5170
|
@nodejs/timers |
I don't really understand what was incorrect before? |
Does this change / fix a problem that could be described as "timer.refresh() does not re-activate a timer which has already timed out"? Does it only change that case? |
I'm well sorry about my English, The most accurate description: When refresh calls a timer that has already been called, the current timer cannot be re-marked as an active event in the event loop. If there is no other event activity, node will exit directly.
Can not... I looked at the 10.x code and it seems to be a bit different.
I think yes, |
Add an or option for put refresh back to work. nodejs#26721 one reason it can't be overridden it only works in the callback of the current timer(before `finally`).
261530e
to
33ab12e
Compare
Ok I think this may also be fixed by #27345, but this might be able to land sooner / be backported more. cc @apapirovski |
If #27345 works well with 10.x, I like it better because it's more like a refactoring, and this one is a bit like monkey patch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make sure that the test fails on older platforms it's probably useful to start a child process and to log something. That way the main process could verify the output and the broken behavior would be observable.
Closing, since #27345 landed. Please leave a comment if this is not fixed by that PR! |
Refresh.() does not get a timer active that has already been invoked. Add an or option for put refresh back to work.
#26721 one reason it can't be overridden it only works in the callback of the current timer(before
finally
).Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes