fix: resolve batched request resolver defects hanging consumer fibers#6139
Merged
tim-smart merged 2 commits intoEffect-TS:mainfrom Mar 22, 2026
Merged
Conversation
Signed-off-by: Marc MacLeod <marbemac+gh@gmail.com>
🦋 Changeset detectedLatest commit: 7693751 The changes in this PR will be included in the next version bump. This PR includes changesets to release 36 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
tim-smart
approved these changes
Mar 22, 2026
Signed-off-by: Marc MacLeod <marbemac+gh@gmail.com>
auto-merge was automatically disabled
March 22, 2026 22:07
Head branch was pushed to by a user without write access
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.
Type
Description
When a
RequestResolver.makeBatchedresolver dies with a defect (e.g.Effect.die), all consumer fibers waiting on requests from that batch hang forever. The requestDeferreds are never completed, soEffect.requestcallers block indefinitely ondeferredAwait.Root Cause
In
invokeWithInterrupt(fiberRuntime.ts), the cleanup logic that completes uncompleted request entries withexitInterruptwas chained viacore.flatMap(OP_ON_SUCCESS), which only runs on success. When the daemon fiber running the resolver fails, the cleanup is skipped entirely.Fix
Replaced
core.flatMapwithensuringso the cleanup runs on all exit types (success, failure, and interruption). This is consistent with howensuringis already used elsewhere in the fiber runtime (e.g.acquireRelease,addFinalizer).