-
Notifications
You must be signed in to change notification settings - Fork 2.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
Assert we drained the microtask queue since the last time we called into JavaScript #8646
Conversation
❌ @Jarred-Sumner 3 files with test failures on bun-darwin-aarch64:
|
❌ @Jarred-Sumner 3 files with test failures on linux-x64-baseline: |
❌ @Jarred-Sumner 3 files with test failures on linux-x64: |
❌ @Jarred-Sumner 6 files with test failures on bun-darwin-x64:
|
❌🪟 @Jarred-Sumner, there are 10 test regressions on Windows x86_64
|
4ed5404
to
c5646b3
Compare
this.drainMicrotasksWithGlobal(this.global); | ||
} | ||
|
||
this.entered_event_loop_count -= 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be an assertion that it's never negative?
What does this PR do?
This adds an assertion in debug builds that checks we called
drainMicrotasks
after calling into a JavaScript function.This adds a helper method
EventLoop.runCallback
for calling into JavaScript functions from the top of the event loop. This will handle exceptions and release weakrefs and anything else we may need to do in the future.This also fixes cases where we weren't draining microtasks in:
open
andclose
callbacks in Bun.serve() WebSocketsThe panic looks like this:
It only tracks function names if
BUN_TRACK_LAST_FN_NAME=1
How did you verify your code works?
Manually