This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Incorrect loop->active_handles count when nested setTimeout calls have same value #25831
Comments
abbr
added a commit
to abbr/node
that referenced
this issue
Aug 10, 2015
Call start regardless whether list is new or not to prevent incorrect active_handles count. Fixes nodejs#25831.
This was referenced Aug 10, 2015
Could be related to #25763 |
abbr
added a commit
to abbr/node
that referenced
this issue
Sep 8, 2015
Call start regardless whether list is new or not to prevent incorrect active_handles count. Fixes nodejs#25831.
abbr
added a commit
to abbr/node-1
that referenced
this issue
Sep 10, 2015
Call start regardless whether list is new or not to prevent incorrect active_handles count. Fixes nodejs/node-v0.x-archive#25831.
abbr
added a commit
to abbr/node-1
that referenced
this issue
Oct 13, 2015
Call start regardless whether list is new or not to prevent incorrect active_handles count. Fixes nodejs/node-v0.x-archive#25831
Has there been any progress on this? Does this fix have other potential consequences? |
4 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I maintain a c++ module deasync (originally written by @vkurchatkin) which essentially exposes
uv_run
to jsLand in order to address some use cases that cannot be handled by other async-2-sync modules. A problem was reported recently that whendeasync
is involved in nestedsetTimeout
calls with same timeout value, the process hung. It is illustrated by codeoutput
Changing one of the timeout values of
setTimeout
yields expected outputProblem is reproducible in latest Node version on at least Linux and Windows. I have run
node
in gdb session and found the problem isloop->active_handles
has gone down to 0 after the innersetTimeout
is called but before its handler is triggered, therefore the inner handler doesn't have a chance to run.I think the cause is that timers of same timeout value are implemented using a linked list and only one handle is exposed to libuv. This handle is removed at the time the outer
setTimeout
handler is called.By moving
list.start(msecs, 0)
in/lib/timers.js
outside else block, I have verified the problem can be fixed. Will supply a PR later. What I am not clear is the impact of this change. Appreciate if someone can review the issue and my PR.(P.S. I have read Node issue reporting guidelines and understand I am not supposed include dependencies. But
deasync
is simple, has no dependency by itself, and is easy to be re-factored into a dependency-less mixture of c++ and js code)The text was updated successfully, but these errors were encountered: