-
-
Notifications
You must be signed in to change notification settings - Fork 35.6k
Infinite loop in timers.js #9756
Copy link
Copy link
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.timersIssues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.timersIssues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.Issues and PRs related to the timers subsystem / setImmediate, setInterval, setTimeout.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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
nextgets cleared.The issue first manifests itself in this commit: 42158a0
The
ifbranch that causes an infinite loop was first introduced innode/lib/timers.js
Lines 514 to 519 in 6f75b66
immediatewill 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.