Repository navigation
Conversation
…under high concurrency ReadTimeout (10s) is measured from TCP accept, so it includes time the serve goroutine spends queued in the Go scheduler before it runs. Under high concurrency that queue time alone can exceed 10s, so the deadline fires before io.ReadAll ever executes - surfacing as i/o timeout body-read errors that look like client disconnects or auth failures. The intended per-request ceiling is the RequestTimeout middleware (cfg.RequestTimeout, the context deadline), which ReadTimeout preempts and so is never reached. Remove ReadTimeout and the now-unused maxReadTimeout const. ReadHeaderTimeout (5s) is kept for slowloris protection: once headers arrive there is no meaningful slow-body surface, since request bodies on this API are small JSON payloads sent in a single TCP segment. WriteTimeout (75s, asserted > cfg.RequestTimeout at compile time) is unchanged. Rebased onto current main at the maintainers invitation on e2b-dev#3416. Closes e2b-dev#3415.
AdaAibaby
requested review from
ValentaTomas,
dobrac and
jakubno
as code owners
October 22, 2026 06:27
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rebased follow-up to #3416, which @ryan-sana closed with an invitation to "rebase the one-line change onto current main." The
ReadTimeoutcode is still present onmain(packages/api/main.go:254), so the problem in #3415 is unaddressed.Summary
ReadTimeout: maxReadTimeout(10s) from thehttp.Server.maxReadTimeoutconstant.ReadHeaderTimeout: 5s(slowloris protection) andWriteTimeout: 75sunchanged.Net diff: 2 deletions.
Why
ReadTimeoutis measured from TCP accept, so it includes the time the serve goroutine spends queued in the Go scheduler before it runs. Under high concurrency that queue time alone can exceed 10s, so the deadline fires beforeio.ReadAllever executes — surfacing asi/o timeoutbody-read errors that look like client disconnects or auth failures.The intended per-request ceiling is the
RequestTimeoutmiddleware (cfg.RequestTimeout, a context deadline — still wired atmain.go:173), whichReadTimeoutpreempts and so is never reached in practice.Once headers have arrived (guarded by
ReadHeaderTimeout), there's no meaningful slow-body attack surface: request bodies on this API are small JSON payloads sent in a single TCP segment.WriteTimeout(asserted> cfg.RequestTimeoutat compile time) still bounds the response side.Verification on current main
ReadTimeout/maxReadTimeoutconfirmed still present and used only at the server construction site (no other references).RequestTimeoutmiddleware,ReadHeaderTimeout, and theWriteTimeoutcompile-time assertion all still in place — so the diagnosis holds unchanged.go build ./packages/api/...andgo vetpass.Test plan
i/o timeoutbody-read errors disappear./healthstill responds under load.ReadHeaderTimeout): a client that opens a connection but never sends headers is dropped.Closes #3415. Supersedes #3416.