Repository navigation
test(sdkharness): upload.stall meets its request-timeout need through http_session_factory - #628
Merged
Merged
Conversation
… http_session_factory b2sdk has no timeout option, but B2Http passes its timeout to Session.request on every call (b2sdk/_internal/b2http.py), and B2HttpApiConfig documents http_session_factory. A Session subclass that clamps the read timeout to 5 s makes the 60 s stall give up, after which the upload retries on a new upload URL. The check used to report no-client-option. Co-Authored-By: Claude Sonnet 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.
What
The sdkharness
upload.stallcheck (.sdkharness/tests/resilience/upload.stall) used to reportSKIP no-client-optionbecause b2sdk documents no request-timeout option. It now runs: it passesB2HttpApiConfig(http_session_factory=...)arequests.Sessionsubclass that clamps the read timeout to 5 s, arms the 60 sb2_upload_filestall, uploads 1 KiB, and asserts from the simulator journal that the stalled request was abandoned, the nextb2_upload_filewent to a differentuploadUrlId, and the file reads back intact.Why this is possible
B2Httppasses its timeout to the session on every call (b2sdk/_internal/b2http.py:self.session.request(..., timeout=(self.CONNECTION_TIMEOUT, _timeout or self.TIMEOUT_FOR_UPLOAD)), v2.13.1), andhttp_session_factoryis a documentedB2HttpApiConfigparameter. The check's earlier note ("unconfirmed, not absent") named exactly this path.Checked
bin/run-resilience.sh --scenario upload.stall b2-sdk-pythonfrom the sdkharness at the standalone simulator pin: PASS (the runner only accepts a PASS when the journal shows the stall fired). The b2sdk code under test is unchanged; only.sdkharness/and a changelog fragment change.Tracks backblaze-labs/demand-side-ai#1257 (and #1120).
🤖 Generated with Claude Code