Streaming request body errors are always reported as `internal`

Aperta
#352 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

@AhmedElBanna80 ci sta già lavorando.

Dal 15/11/2026.

  • #353 di @AhmedElBanna80 — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Start in connectrpc/src/service.rs tests and trace decode_request_body through the streaming body read path; compare its error handling with collect_body_limited. Reproduce the Limited body case and a body error containing a ConnectError, then check that the stream reports resource_exhausted or forwards the Connect error while unrelated errors remain internal. Keep the public API unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The server reports every failure of a streaming request body as internal, whatever the error is. The unary path does not: collect_body_limited maps http_body_util::LengthLimitError to resource_exhausted.

This matters to a server that bounds a client- or bidi-streaming request in total, for example by wrapping the body in http_body_util::Limited, or with a body whose error is (or wraps) a ConnectError. The handler's request stream ends with internal: failed to read request body: ..., and the client cannot tell "too large" or "shedding load" from a broken transport.

Related but different: #321 (size-limit errors the client sees) and #150 (introduced surfacing body errors to handlers).

Repro (in connectrpc/src/service.rs tests, using decode_request_body):

// Limited's error is Box<dyn Error>, which is not an Error, so adapt it with
// a newtype that keeps the source.
let body = BodyExt::map_err(Limited::new(Full::new(two_messages), 12), Boxed);
let mut stream = decode_request_body(body, DEFAULT_MAX_MESSAGE_SIZE, None, registry);
let err = stream.next().await.unwrap().unwrap_err();
assert_eq!(err.code, ErrorCode::ResourceExhausted); // actual: Internal

The same happens when a body fails with a ConnectError (for example unavailable): the handler sees internal.

Proposed fix (PR to follow): the streaming internals only require B::Error: Display + Send today, while the public Service impl already requires std::error::Error + Send + Sync + 'static. Take the same bound internally, then on a body-read failure walk the error's source chain: a ConnectError is forwarded as it is, a LengthLimitError becomes resource_exhausted (matching the unary path), and anything else stays internal. No public API change.

Lingua principale
Rust
Stelle
542
Fork
74
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di connectrpc/connect-rust

Tutte le issue di connectrpc/connect-rust

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.