-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
setTimeout can fire twice #1191
Comments
For posterity this was found during irc discussion with @trevnorris last night regarding #1152 -- http://logs.libuv.org/io.js/2015-03-17#23:26:55.816 |
Looks a
Why does |
Or rather, I think the issue is with the unenroll list being empty. |
It seems to me as though it doesn't expect you to unref during it's own callback. I.e. it does not check that the callback has already been or is being called.. |
I'm pretty certain that |
I'm not sure unref needs to make a handle in the case that the callback is already being called. |
Yeah, it's too late to unref a already fired timer, that |
Hold on, I got an idea. |
Nope, I think I can't do without a tracking property on the timeout. 😢 |
Calling this.unref() during the callback of SetTimeout caused the callback to get executed twice because unref() didn't expect to be called during that time and did not stop the ref()ed Timeout but did start a new timer. This commit prevents the new timer creation when the callback was already called. Fixes: #1191 Reviewed-by: Trevor Norris <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> PR_URL: #1231
Fixed in b0f8e30 |
Calling this.unref() during the callback of SetTimeout caused the callback to get executed twice because unref() didn't expect to be called during that time and did not stop the ref()ed Timeout but did start a new timer. This commit prevents the new timer creation when the callback was already called. Fixes: #1191 Reviewed-by: Trevor Norris <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> PR-URL: #1231
Test to reproduce:
I haven't had the time to investigate, but want to make sure this issue can be tracked.
The text was updated successfully, but these errors were encountered: