-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Runloop can drop events #16296
Comments
Thank you for the detailed write up! I’ll start digging in (first via failing test cases in back burner itself). In the meantime, I will revert the back burner update (to ensure we don’t let 3.1 out the door with this issue)... |
Copied writeup to BackburnerJS/backburner.js#332 for tracking the upstream fix... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello fans of timing bugs, today I have a fun one for you.
The new microtask-based autorun architecture can drop scheduled events. To see it in action, you can run the following against 3.1 beta:
If you fire the
testIt
event, the console logsThe number of layers of promises required to experience the bug depends on which queue you're trying to schedule. The runloop spends one microtask per queue, so our stack of promise resolutions is interleaved with each queue's flush. In the above example, we schedule on the
actions
queue immediately after that queue has just flushed, and the runloop never notices.You can make it drop events on any other queue just by varying the number of promises you resolve in between the time you first trigger an autorun and the time you schedule your doomed event.
I published a working example of the bug here: https://github.com/ef4/bug-repro/tree/bad-timing
The text was updated successfully, but these errors were encountered: