Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

timer spinner race condition #4866

Closed
trevnorris opened this issue Feb 27, 2013 · 2 comments
Closed

timer spinner race condition #4866

trevnorris opened this issue Feb 27, 2013 · 2 comments

Comments

@trevnorris
Copy link

There is an issue where timers < 6ms will run before callbacks passed to nextTick when the callback is fired through _tickFromSpinner:

setTimeout(function() {
    process.nextTick(function() {
        console.error('nextTick');
    })
    setTimeout(function() {
        console.error('setTimeout');
    }, 1);
    // N setTimeout's can be created w/ timeout < 6ms
    // which will all fire before the nextTick callback
}, 1);

// output:
// setTimeout
// nextTick

This issue goes back to the v0.8 branch.

@AlexeyKupershtokh
Copy link

// N setTimeout's can be created w/ timeout < 6ms

Do you mean that if you write setTimeout(function() {...}, 5) the result would be the same?
There's a known bug #4194 that allows timers false starts but this would work for 1ms timeouts only.

@trevnorris
Copy link
Author

Hm. I can't seem to reproduce it and didn't keep anything on it. Well, whatever.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants