Skip to content

fix: add read/write timeouts for server stream requests#1203

Open
passionworkeer wants to merge 2 commits intoe2b-dev:mainfrom
passionworkeer:fix/stream-timeout
Open

fix: add read/write timeouts for server stream requests#1203
passionworkeer wants to merge 2 commits intoe2b-dev:mainfrom
passionworkeer:fix/stream-timeout

Conversation

@passionworkeer
Copy link

When a sandbox becomes unreachable, commands.run() hangs indefinitely because the underlying httpx stream does not have read/write timeouts set.

The _prepare_server_stream_request method only set connect and pool timeouts, but omitted read and write timeouts. This is inconsistent with _prepare_unary_request which correctly sets all four timeouts.

This fix adds read and write timeouts to server stream requests, ensuring that commands.run() respects the request_timeout parameter even when the sandbox becomes unreachable.

Closes #1128

Copilot AI review requested due to automatic review settings March 15, 2026 05:23
@changeset-bot
Copy link

changeset-bot bot commented Mar 15, 2026

🦋 Changeset detected

Latest commit: 7dcc457

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@e2b/python-sdk Patch

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns timeout handling for Connect server-stream requests with unary requests by applying the provided request_timeout not only to connection/pool acquisition but also to read/write operations. This helps ensure streaming calls respect the configured request timeout behavior consistently across RPC styles.

Changes:

  • Add read and write timeout values to the httpcore extensions["timeout"] dict for server-stream requests.
  • Keep existing connect-protocol headers and stream timeout header behavior unchanged.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@passionworkeer
Copy link
Author

Thanks for the review! This is a fix for stream request timeout when using httpx. The stream requests were missing read/write timeout configuration compared to unary requests. Let me add a changeset for this.

@passionworkeer
Copy link
Author

Thanks for the review! Here's the changeset:


@e2b/python-sdk: patch

fix: add read/write timeouts for server stream requests

Please add this, or I'll create a new PR from my fork.

@passionworkeer
Copy link
Author

Hi, I noticed the commit is currently unsigned. Could you please sign the commit with git commit -S and force push to meet the signature requirement? Let me know if you need help with setting up GPG signing.

When a sandbox becomes unreachable, commands.run() hangs indefinitely
because the underlying httpx stream does not have read/write timeouts set.

The _prepare_server_stream_request method only set connect and pool
timeouts, but omitted read and write timeouts. This is inconsistent with
_prepare_unary_request which correctly sets all four timeouts.

This fix adds read and write timeouts to server stream requests, ensuring
that commands.run() respects the request_timeout parameter even when
the sandbox becomes unreachable.

Closes e2b-dev#1128

Signed-off-by: passionworkeer <passionworkeer@users.noreply.github.com>
@passionworkeer
Copy link
Author

Hi, I've signed the commit with GPG. Could you please re-review?

@ValentaTomas ValentaTomas removed their request for review March 21, 2026 06:40
@passionworkeer
Copy link
Author

Hi @mishushakov, just checking in on this PR. Copilot reviewed it with no issues, the commit is GPG signed, and the changeset is added. Is there anything else needed from my side to move this forward for merge? Happy to make any adjustments.

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.

[Bug]: commands.run hangs indefinitely when sandbox becomes unreachable — request_timeout does not set read timeout on streaming calls

2 participants