Repository navigation
[Prototype] Node 24: count await continuations that block on their dispatch fiber (port of #12) - #13
Draft
jbaczuk-qualia wants to merge 1 commit into
Draft
jbaczuk-qualia wants to merge 1 commit into
jbaczuk-qualia wants to merge 1 commit into
Conversation
Fiber.awaitContinuationBlocks counts code after an `await` that blocked on the hidden fiber the dispatcher gave it (Future.wait, Promise.await, a sync Meteor call). Without the dispatch each of these would have thrown "Can't wait without a fiber", so the count tracks code that still depends on fibers after an await. It's counted in the dispatcher's existing "job blocked" branch, once per job, so jobs that don't block and ordinary yields cost nothing extra. The count lives on the native module so every copy of fibers in a process shares it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #9 (the Node 24 port). Same change as the Node 18 version, #12. Adds
Fiber.awaitContinuationBlocks, a process-wide count of code after anawaitthat blocked on the hidden fiber the dispatcher gave it (Future.wait,Promise.await, a sync Meteor call). On stock fibers each of these throws "Can't wait without a fiber", so the count shows where code still depends on fibers after anawait. Code that just runs on a dispatched fiber and never blocks behaves the same as on stock, so it isn't counted.fibers_async.jsrun() !== kIdleand the fiber is still the dispatch fiber; one-off dispatch: the job didn't finish). Counted once per blocking job. Ordinary yields and jobs that don't block pay nothing. Stored on the native module, so every copy of fibers in a process shares one count.test/await-continuation-blocks.jspass(skips) when dispatch is off.The labelled metric and the dev-only call-site recorder live in qualialabs/qualia#57387.
Testing
Not run on Node 24: the code is identical to the Node 18 version (cherry-picked; the only conflict was next to the AsyncContextFrame probe). Results from the Node 18 build:
test/await-continuation-blocks.js:passby default, withFIBERS_AWAIT_REUSE=0(one-off dispatch path), and withFIBERS_AWAIT_DISPATCH=0(skips).Fiber.awaitContinuationBlocks= 60,000, an exact count.🤖 Generated with Claude Code