Skip to content

test(sdkharness): upload.stall meets its request-timeout need through http_session_factory - #628

Merged
sophiecarreras merged 1 commit into
masterfrom
sdkharness/upload-stall-runnable
Oct 15, 2026
Merged

sophiecarreras merged 1 commit into
masterfrom
sdkharness/upload-stall-runnable

Conversation

@sophiecarreras

Copy link
Copy Markdown
Contributor

What

The sdkharness upload.stall check (.sdkharness/tests/resilience/upload.stall) used to report SKIP no-client-option because b2sdk documents no request-timeout option. It now runs: it passes B2HttpApiConfig(http_session_factory=...) a requests.Session subclass that clamps the read timeout to 5 s, arms the 60 s b2_upload_file stall, uploads 1 KiB, and asserts from the simulator journal that the stalled request was abandoned, the next b2_upload_file went to a different uploadUrlId, and the file reads back intact.

Why this is possible

B2Http passes 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), and http_session_factory is a documented B2HttpApiConfig parameter. The check's earlier note ("unconfirmed, not absent") named exactly this path.

Checked

bin/run-resilience.sh --scenario upload.stall b2-sdk-python from 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

… 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>
@sophiecarreras
sophiecarreras merged commit ffa02b3 into master Oct 15, 2026
28 checks passed
@sophiecarreras
sophiecarreras deleted the sdkharness/upload-stall-runnable branch October 15, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant