Repository navigation
fix: treat interrupted state bodies as offline - #4411
Merged
Merged
Conversation
A successful fetch can lose its response body before JSON decoding finishes. Read the body inside the transport boundary and parse it outside, preserving malformed-state errors while letting an interrupted read retry. The sample media journey exposed this when Reset interrupted the old allocation before its departure events fired. Closes #4252
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.
Reset can interrupt a sample's
/api/statebody after fetch has received its headers but before the child departs.readStateclassified that transport failure as a broken reading because only its own timeout signal made body failures count as offline. It now reads the body inside the transport boundary and parses the completed text outside it: interrupted delivery retries as offline, while malformed JSON still reaches the error boundary. This extends #510's body-timeout handling without changing its read bounds or malformed-state diagnostics.The original media journey reproduced the reported teardown error on main; temporary instrumentation identified the failing body as the old sample allocation's
/api/state, before its departure events. That journey passes with the fix and is unchanged. A deterministic stream-error regression fails before the fix and passes after it, alongside its malformed-JSON control. The existing timeout browser test now intercepts the text-reading boundary.Validation: the media journey and three startup response cases pass; all 674 runtime tests pass; the browser build passes.
A served startup comparison against current main reached upgrade and initial state presentation with 35 requests in each arm and no console errors. JavaScript response bytes changed from 2,058,169 to 2,058,161; total recorded bytes changed from 2,604,907 to 2,605,078.
Closes #4252 — automated triage