Rust: bound JSON-RPC frames and transport queues while preserving cancellation
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- api, backend, networking, testing
Direzione di ricerca
Leggi prima rust/src/jsonrpc.rs, quindi crea i test di trasporto in memoria o loopback elencati per frame sovradimensionati e bloccati, pressione sulle code e cancellazione. Il lavoro è completato quando test deterministici mostrano frame e code con limiti definiti, errori espliciti o backpressure, cancellazione tempestiva, un arresto pulito e il superamento dei normali test di trasporto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Package: Rust Copilot SDK, current main at the time of investigation.
Summary
The Rust JSON-RPC transport accepts peer-provided frame lengths without a configured maximum, has no deadline for completing a partial frame, and uses unbounded channels for outbound frames and inbound request dispatch. A stalled or excessively large peer frame can therefore retain transport work indefinitely or cause allocation and queue growth outside a documented resource envelope.
Add deterministic transport tests and bounded framing and queue behavior while preserving cancellation-safe shutdown.
Current behavior
In rust/src/jsonrpc.rs:
- The writer uses an unbounded queue.
- Inbound request dispatch uses an unbounded channel.
- The parser allocates the message body directly from the peer-provided
Content-Length. - There is no maximum accepted frame size.
- There is no deadline for a peer that sends a header or body only partially.
- Frames are flushed individually. That may affect throughput, but flush batching is intentionally outside this issue.
These are confirmed implementation properties. The severity and production reachability should be determined by the transport tests rather than assumed.
Reproduction and tests
Add in-memory or loopback transport tests for:
- A header declaring an oversized
Content-Length. - A valid header followed by a body that never completes.
- A body delivered slowly enough to exceed the read deadline.
- A blocked writer while callers enqueue enough messages to reach queue capacity.
- A peer flooding inbound requests faster than the application consumes them.
- Cancellation and shutdown while reads, writes, and queue admission are blocked.
Tests should assert bounded allocation, deterministic error propagation, and prompt cancellation rather than depending on process memory exhaustion.
Expected behavior
- The transport rejects frames larger than a documented configurable or fixed maximum before allocating the declared body.
- Header and body reads cannot remain partially complete indefinitely.
- Outbound and inbound transport queues have documented bounds.
- Reaching a queue limit produces explicit backpressure or an explicit transport error rather than silent loss.
- Cancellation unblocks pending reads, writes, and queue admission.
- Transport shutdown completes without leaking worker tasks or dropping the final error state.
- Errors contain enough context to distinguish oversized, timed-out, closed, and backpressured transports.
Proposed scope
Limit this issue to:
- JSON-RPC header and frame-size limits.
- Partial-frame read deadlines.
- The Rust transport's writer queue.
- The Rust transport's inbound request-dispatch queue.
- Cancellation-safe error and shutdown behavior for those limits.
The exact defaults should be chosen from observed protocol payload sizes and compatibility tests.
Acceptance criteria
- Each reproduction has a deterministic automated test.
- Oversized frames are rejected before allocating the declared payload size.
- A stalled partial frame fails within the documented deadline.
- Queue capacity is enforced without silently dropping messages.
- Cancellation completes promptly while blocked on read, write, or admission.
- Normal request, response, notification, and shutdown tests continue to pass.
- Public configuration or error-contract changes are documented for Rust consumers.
Non-goals
- Session-router or application-level queue limits.
- HTTP request-body streaming limits outside the JSON-RPC transport.
- Frame compression.
- Batching or removing per-frame flushes.
- A general retry policy.
- Changes to other language SDK transports in the same issue.
Related work and non-overlap
- #1273 covers cooperative disconnect and shutdown behavior. This issue concerns frame and transport resource limits, while requiring those limits not to regress cancellation safety.
- Lingua principale
- Java
- Stelle
- 10.5k
- Fork
- 1.5k
- Merge medio
- 1g 9h
- PR unite (30g)
- 130
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 github/copilot-sdk
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
github/copilot-sdk#2760 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
github/copilot-sdk#2759 ·
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
github/copilot-sdk#2758 ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
github/copilot-sdk#2709 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
github/copilot-sdk#2673 ·
Tutte le issue di github/copilot-sdk
Issue simili
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
inu-appcenter/memorIN-backend#288 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
frontend maui-pilot pilot-ask question
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Apertaarea/plugin
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
kestra-io/plugin-kestra#190 ·