Repository navigation
test(io): keep the #309 cases off process-wide hooks (#309 follow-up) - #326
Merged
Merged
Conversation
The CI run on the branch failed one unrelated test, `Issue255BodyReserveTests` "the HEAD size probe does not reserve the source it declares", and the same commit was green on main immediately afterwards. The arithmetic in the log names it: `probeFileSize` bounds its wait at `sizeProbeStaggerSeconds + min(25, chunkRequestTimeout) + 2`, which at that test's `chunkRequestTimeout: 5` is 7.75 s, and the test failed after 7.806 s. The loaded runner did not get the staggered HEAD fallback's closure onto a thread inside that budget, so `open()` broke out of the wait and the test read "the HEAD fallback never ran" from a request log holding only the primary probe. Its budget now has room; the wait still exits as soon as a size resolves, so the healthy case is unchanged. The reason to care from here: swift-testing runs suites in parallel, and the #309 cases were reaching for two hooks that every AVIOReader reads at ITS OWN init, so for the seconds they were set they applied to readers built by whatever suite happened to be running alongside. A 2 MB/s source throttle leaking that way starves other suites' readers outright. - `connStallTimeout` becomes an init parameter, like `chunkRequestTimeout`, and the process-wide hook added with the fix is deleted. Still not a `LoadOptions` field (#272 unchanged). - The runway test paces its own read loop instead of setting `sourceThrottleKbpsForTesting`. Measured on a saturated box (10 concurrent 1080p60 encodes, ~690% of 800%): three consecutive full-suite runs green, and the suite went from ~19.5 s to ~12.8 s, which is the leaked throttle no longer slowing other suites down. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
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.
Follow-up to #325. No behaviour change to the shipped path; it removes a test-side hazard and gives one unrelated test the budget it needs.
What the branch CI failure actually was
The CI run on #325 failed
Issue255BodyReserveTests"the HEAD size probe does not reserve the source it declares", and the same commit was green onmainon the next run. The log names the cause arithmetically:probeFileSizebounds its wait atsizeProbeStaggerSeconds + min(25, chunkRequestTimeout) + 2, which at that test'schunkRequestTimeout: 5is 7.75 s, and the test failed after 7.806 s. The loaded runner did not get the staggered HEAD fallback's closure onto a thread inside that budget,open()broke out of the wait, the reader fell back to streaming mode, and the test read "the HEAD fallback never ran" from a request log holding only the primary probe. Its budget now has room. The wait still exits the moment a size resolves, so nothing changes when the origin behaves.The hazard worth removing
swift-testing runs suites in parallel, and
sourceThrottleKbpsForTesting/ the stall-timeout hook are read by everyAVIOReaderat ITS OWN init. For the seconds a test held them, they applied to readers built by whatever suite happened to be running alongside it. A 2 MB/s source throttle leaking that way starves another suite's reader outright, and a shortened stall threshold makes it reconnect early.connStallTimeoutis now an init parameter, exactly likechunkRequestTimeout, and the process-wide hook that fix(io): notice a silently dead connection on wall-clock time (#309) #325 added is deleted. Still not aLoadOptionsfield: Make AVIOReader.connStallTimeout configurable — 20 s is a long time to hold a frozen frame when the origin is on the same LAN #272 measured a shorter threshold to be worse under CPU starvation, unchanged.Measured
Saturated box (10 concurrent 1080p60 encodes, ~690% of 800%): three consecutive full-suite runs green. The suite also went from ~19.5 s to ~12.8 s under the same load, which is the leaked throttle no longer slowing other suites' readers down.
The #309 cases still pass and still fail when either half of the fix is disarmed; passing at all is now also the proof that the threshold parameter is wired, since at the shipped 20 s none of them would finish in time.
🤖 Generated with Claude Code