-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Infinite loop in timers.js #9756
Labels
confirmed-bug
Issues with confirmed bugs.
timers
Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Comments
mscdex
added
the
timers
Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
label
Nov 23, 2016
This was referenced Nov 23, 2016
hassy
added a commit
to artilleryio/arrivals
that referenced
this issue
Dec 8, 2016
Stop the timer when the expected number of arrivals is reached rather than with another timeout. This is to avoid triggering a Node.js bug that leads to using 100% CPU. Ref: nodejs/node#9756
hassy
added a commit
to hassy/node
that referenced
this issue
Dec 13, 2016
If current immediate has no callback, move on to the next one in the queue. Fixes: nodejs#9756 PR-URL: nodejs#9759
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
confirmed-bug
Issues with confirmed bugs.
timers
Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
v6.8.1 and above will all hang when the following code is run:
An example run of the code above:
The cause is Node entering into an infinite loop here when immediate._onImmediate is
null
:(source: https://github.com/nodejs/node/blob/master/lib/timers.js#L580-L587)
This happens when the immediate referred to by
next
gets cleared.The issue first manifests itself in this commit: 42158a0
The
if
branch that causes an infinite loop was first introduced innode/lib/timers.js
Lines 514 to 519 in 6f75b66
immediate
will not change once the condition is hit.I'll send a PR to go along with this with a proposed fix.
EDIT 1: Simplified the test case.
The text was updated successfully, but these errors were encountered: