Repository navigation
fix(python-sdk): stop buffering streamed request bodies on the retrying transports #1701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
b98324e
fix(python-sdk): stop buffering streamed request bodies on the retryi…
cursoragent 7f12167
test(python-sdk): assert the streamed body is read once across a retry
cursoragent 945624c
fix(python-sdk): correct the affected paths and pin both retry policies
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| "@e2b/python-sdk": patch | ||
| --- | ||
|
|
||
| Stop mirroring streamed request bodies in memory while they are being sent, on a | ||
| pyqwest whose retry middleware exposes `RetryMode` (older releases keep the | ||
| buffered replay they ship, so this is inert until the `pyqwest` dependency | ||
| allows one). The shared retrying transports declare pyqwest's unbuffered retry | ||
| policy, so a streamed `files.write` of a file-like object or `volume.write_file` | ||
| is no longer copied into a replay buffer as it goes to the wire, and peak memory | ||
| stays flat instead of scaling with file size. Connect retries are unchanged: a | ||
| connect error means the body was never read, so the same body is handed to the | ||
| next attempt, and `bytes` bodies (unary RPC payloads, in-memory writes) were | ||
| already replayable for free. |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This override is entirely unpinned. Deleting it here and in
client_asyncleaves the suite at 2 passed / 6 skipped — identical to head — because on pyqwest 0.9.0 the inheritedshould_retry_requestalready returnsTrue.So an accidental removal (or a refactor that drops it while collapsing the two transports) is silent today, and only surfaces as a memory regression once pyqwest ships
RetryMode. Cheap guard:Verified: passes on head, and fails for both transports when the override is removed. The
__dict__check is what does the work — asserting only the return value cannot catch it whileunbuffered_retriesisTrue.