Repository navigation
Conversation
Contributor
Author
|
@nyannyacha @kallebysantos Gentle ping. This still merges cleanly on current |
da1suk8
force-pushed
the
fix/user-worker-fetch-settle
branch
from
December 2, 2026 14:52
40fab29 to
00e071e
Compare
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
Fixes #742.
UserWorker.fetch()waits for the request body pipe and the response withPromise.allSettled. When the body is a branch of a tee'd stream (req.clone()), the pipe never settles:op_user_worker_fetch_sendreturns, withWorkerAlreadyRetiredor with an early response, the Rust side cancels the request body resource.pipeTocancels its source. Cancelling one tee branch does not resolve until the other is cancelled too, and nobody reads the other.allSettled, andfetch(), never resolve.fetch()now awaits only the response. The pipe keeps running in the background with its rejection swallowed, as before (#374). The early-response case is the runtime side of #737.requestBodyRidis closed only when the dispatch fails. Closing it after a response too, as the first revision did, ends aContent-Lengthbody short, so hyper aborts the connection and loses a response body still in flight (pointed out in #790).Validation
Three integration tests,
test_user_worker_fetch_*, on a new fixturemain_retired_worker_fetch:settles_when_worker_already_retired: no body, a passed-through body and a cloned body all reject withWorkerAlreadyRetired. Onmainthe cloned case times out.settles_when_response_arrives_before_body_is_sent: a cloned upload to a worker that returns 413 without reading it. Onmainit times out.relays_response_body_that_follows_the_head: aContent-Lengthbody that has not arrived yet, and a response body sent 100 ms after its head. Onmainit times out; with the resource closed on every exit, reading the body fails.The other integration tests behave the same as with
main'sfetch()on my machine (macOS). clippy and the format check pass.Limitations
Does not fix #790: the Rust side still cancels the request body once the response head returns, so a response body still in flight when the next request-body chunk arrives is lost, as on
main.