Skip to content
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 refreshed timers exiting too early #26672

Closed
wants to merge 1 commit into from

Conversation

starkwang
Copy link
Contributor

@starkwang starkwang commented Mar 15, 2019

If a timer is refreshed in its callback, we should not decrease refCount to prevent exiting event loop ahead of time.

Fixes: #26642

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

If a timer is refreshed in its callback, we should not decrease `refCount`
to prevent exiting event loop ahead of time.

Fixes: nodejs#26642
@nodejs-github-bot nodejs-github-bot added the timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout. label Mar 15, 2019
@starkwang
Copy link
Contributor Author

@Trott
Copy link
Member

Trott commented Mar 15, 2019

@nodejs/timers

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 15, 2019
@Fishrock123
Copy link
Contributor

I feel like there should be a better way to do this using existing properties but i’ll Need to check exactly when I am at my computer.

Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is possible without a new property but also the current implementation is broken because the timer ends up "refed" in a way that cannot actually be unrefed later (note that timer[kRefed] is still set to null). The destroy hooks will also fire even though they shouldn't.

@starkwang
Copy link
Contributor Author

Closed due to #26721

@starkwang starkwang closed this Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. timers Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v11.11.0 timeout.refresh() does not seem to prevent event loop from exiting
7 participants