Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Rust: bound JSON-RPC frames and transport queues while preserving cancellation

オープン
#2,510 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust

調査の方向性

まず rust/src/jsonrpc.rs を読み、その後、サイズ超過および停止したフレーム、キューの圧迫、キャンセルについて、列挙されたインメモリまたはループバックトランスポートのテストを構築します。完了の条件は、決定論的なテストによって、フレームとキューに上限があること、明示的なエラーまたはバックプレッシャーがあること、キャンセルが速やかに行われること、正常にシャットダウンすること、および通常のトランスポートテストに合格することが示されることです。

索引モデルが issue の本文から書いたものです。

説明

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:

  1. A header declaring an oversized Content-Length.
  2. A valid header followed by a body that never completes.
  3. A body delivered slowly enough to exceed the read deadline.
  4. A blocked writer while callers enqueue enough messages to reach queue capacity.
  5. A peer flooding inbound requests faster than the application consumes them.
  6. 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.
主要言語
Java
スター
10.5k
フォーク
1.5k
平均マージ
1日 9時間
マージ済み PR(30日)
130

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

github/copilot-sdk のほかの issue

github/copilot-sdk の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。