-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
clearTimeout blocks the process (100% CPU usage) #23860
Comments
@apapirovski Probably has a better idea as to the cause in the current codebase than I do, but I can look in a day or two otherwise. |
@morkai Can you try running with |
I can reproduce with the above but I can't make a reproduction that doesn't involve |
--prof-process results: https://gist.github.com/morkai/4c2b3bc3cec692dfb30076eaa4ae1ee8 --prof & --prof-process output and a CPU profile: node_issue_23860_clearTimeout.zip |
Reduced testcase: function noop() {}
const timers = [];
timers.push(setTimeout(noop, 100));
timers.push(setTimeout(noop, 150));
timers.push(setTimeout(noop, 200));
timers.push(setTimeout(noop, 250));
timers.push(setTimeout(noop, 300));
setTimeout(() => {
console.log('200 called');
}, 200);
setTimeout(() => {
console.log('400 called');
}, 400);
setTimeout(() => {
console.log('500 called');
}, 500);
timers.forEach(t => clearTimeout(t)); Reproducable here, I'm pretty sure this is confirmed. |
Thanks @ChALkeR. Working on a PR. Edit: Also I'm an idiot... 😞 |
PR-URL: #23870 Fixes: #23860 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #23870 Fixes: #23860 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
The following code should output TEST every 10s:
Version 11.0.0 hangs with 100% CPU usage (memory stays the same). v8.12.0 and v10.9.0 works.
test.js
was run for 60s in v8, v10 and v11:EDIT 1:
The following code hangs node v11 if
N > 6
(sometimes TEST is printed twice):EDIT 2:
Just found out about
NODE_DEBUG=timer
:The text was updated successfully, but these errors were encountered: