fix(python-sdk): stop leaking per-call proxy pools in volume content clients#1534
fix(python-sdk): stop leaking per-call proxy pools in volume content clients#1534mishushakov wants to merge 1 commit into
Conversation
…clients The volume content client factories passed both `proxy` and the shared cached `transport` to httpx. When a proxy was configured, httpx mounted a fresh, never-closed proxy transport per client — one per volume operation — bypassing the cached transport entirely. Drop the client-level `proxy`; it is already baked into the cached transport. Also add connect-level retries (E2B_CONNECTION_RETRIES, default 3) to the volume transports, matching the core API and envd transports. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR SummaryLow Risk Overview Sync and async volume transports now use Reviewed by Cursor Bugbot for commit f5a3bb4. Bugbot is set up for automated code reviews on this repo. Configure here. |
🦋 Changeset detectedLatest commit: f5a3bb4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Package ArtifactsBuilt from 361e3e7. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.32.1-volumes-unclosed-connections.0.tgzCLI ( npm install ./e2b-cli-2.13.2-volumes-unclosed-connections.0.tgzPython SDK ( pip install ./e2b-2.31.0+volumes.unclosed.connections-py3-none-any.whl |
There was a problem hiding this comment.
LGTM — small, symmetric fix matching the pattern already used by the core API/envd transports (proxy dropped when transport is passed; connect retries added).
Extended reasoning...
Overview
This PR fixes a connection-pool leak in the Python SDK's volume content clients. Only 3 files change: a changeset and the sync/async volume client factories. The substantive change is ~5 lines in each of the two client files: drop "proxy": config.proxy from httpx_args (the proxy is already baked into the cached transport, so passing both caused httpx to mount a fresh, never-closed proxy transport on every client creation), and add retries=connection_retries to the transport constructor.
Security risks
None. The proxy is still honored via the cached transport — proxied traffic keeps working. No auth, crypto, or permission surface is touched.
Level of scrutiny
Low. This is a targeted bug fix that mirrors an established pattern in the same codebase: e2b/api/__init__.py:209-216 already sets httpx_args["proxy"] only when no transport is provided, and tests/test_api_client_transport.py:43,231 already asserts "proxy" not in api_client._httpx_args when a transport is passed. The connection_retries constant (E2B_CONNECTION_RETRIES, default 3) is defined in e2b/api/__init__.py:71 and already used by both the API and envd transports.
Other factors
Sync and async implementations are updated symmetrically as required by CLAUDE.md. A patch-level changeset is included. Cursor Bugbot flagged this as low risk. No outstanding reviewer comments.
The Python volume content client factories passed both
proxyand the shared cachedtransportto httpx, so with a proxy configured (e.g.Volume.connect(volume_id, proxy="http://user:pass@127.0.0.1:8080")), every volume operation mounted a fresh, never-closed proxy transport that bypassed the cached connection pool. The client-levelproxyargument is now dropped — the proxy is already baked into the cached transport, so proxied requests keep working but reuse one pooled transport per thread/event loop.The volume transports also gained connect-level retries (
E2B_CONNECTION_RETRIES, default 3), matching the core API and envd transports. Includes a changeset for a@e2b/python-sdkpatch release.🤖 Generated with Claude Code