api: ReadTimeout: 10s kills body reads under high concurrency, conflicting with requestTimeout: 70s
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 85/100
Direzione di ricerca
Inizia da packages/api/main.go e ispeziona la configurazione dei timeout di http.Server, in particolare ReadTimeout, ReadHeaderTimeout e il middleware requestTimeout descritto nell’issue. Il lavoro è completo quando ReadTimeout viene rimosso, ReadHeaderTimeout e la scadenza di 70 secondi per la richiesta vengono mantenuti, quindi si verifica che l’API venga compilata e che i test esistenti passino.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Under high concurrency (e.g. 1 000 simultaneous sandbox creates) the API returns a flood of errors with:
reading failed: read tcp 192.168.0.146:3000->...: i/o timeout
Root cause
packages/api/main.go configures two competing timeouts:
| Setting | Value | Scope |
|---|---|---|
ReadTimeout |
10 s | Starts at TCP accept; covers headers + body |
requestTimeout |
70 s | Context deadline applied by middleware |
Go's http.Server.ReadTimeout starts counting from the moment the TCP connection is accepted — including scheduler queue time. Under high concurrency, goroutines may wait >10 s in the scheduler before they ever execute and call io.ReadAll. By then the ReadTimeout has already fired and the connection is dead.
requestTimeout: 70 s is the intended per-request ceiling but is never reached in practice because ReadTimeout: 10s fires first.
Why ReadHeaderTimeout is sufficient
ReadHeaderTimeout: 5s already guards against slowloris (headers never arrive). Once headers are received and ServeHTTP starts, request bodies on this API are small JSON payloads (<1 KB) sent in a single TCP segment — there is no meaningful slow-body attack surface. The requestTimeout: 70s middleware context provides the actual per-request deadline for handler execution.
Fix
Remove ReadTimeout from the http.Server config. Keep ReadHeaderTimeout for slowloris protection.
- Lingua principale
- Go
- Stelle
- 1.6k
- Fork
- 438
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di e2b-dev/runtime
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
sandbox cache: StartRemoving state transition not broadcast, all allocations see stale Running state Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Tutte le issue di e2b-dev/runtime
Issue simili
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
microsoft/agent-framework-go#1179 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
[Bug]: OLLAMA_KEEP_ALIVE="5m" / "24h" crashes Ollama embedding and vision models with ValueError Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
infiniflow/ragflow#20223 · 1 reazione ·
-
bug needs triage pkg/translator/faro
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
open-telemetry/opentelemetry-collector-contrib#51484 · 1 commento ·