e2b-dev / e2b-dev/runtime

envd: streaming RPCs starve behind reverse proxies that buffer responses

Open
#2,707 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1.6k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

Summary

envd's server-streaming RPCs (Process.Start, Process.Connect,
Filesystem.WatchDir) don't advertise to reverse proxies that their
responses are streaming. Behind a stock nginx (default
proxy_buffering on), chunks are held until the proxy buffer fills,
which makes interactive PTYs appear to accept input but produce no
output until something forces a flush.

The usual workaround — globally disabling proxy_buffering — also
gives up caching and weakens proxy_next_upstream retries for unary
RPCs that don't need streaming. Letting envd signal intent per
response is more surgical.

Affected handlers

  • process.Process/Start (process/start.go)
  • process.Process/Connect (process/connect.go)
  • filesystem.Filesystem/WatchDir (filesystem/watch.go)

Proposed fix

A small connect-go interceptor that sets X-Accel-Buffering: no on
server-streaming responses, wired into the existing
connect.WithInterceptors(...) chain. Unary and client-streaming RPCs
pass through unchanged.

X-Accel-Buffering is read by nginx (and other proxies that follow the
convention) on a per-response basis:

I have a patch ready (~60 LoC in a new internal/services/streaming
package + 2-line wiring per service + unit tests). Happy to open a PR
if the direction is right.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with process/start.go, process/connect.go, and filesystem/watch.go, then trace the existing connect.WithInterceptors(...) wiring for each service. Verify the server-streaming responses and unit-test coverage first. Done means nginx receives X-Accel-Buffering: no for those streaming RPCs while unary and client-streaming RPCs remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend-api-design, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.