Drop support for mpsc frames without the MessageEnd byte

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

メンテナーはふだん 2 日以内に返信

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

評価

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

調査の方向性

Read decode_frame and its protocol version or ALPN handling, along with the related discussion in #27. Trace how frame length and MessageEnd are decoded, then check the protocol tests for compatibility cases. Done means frames require an end byte, aborted frames are dropped before decoding, malformed frames return protocol errors, and the wire break is accompanied by a version bump.

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

説明

Since #167, an mpsc frame ends with a one-byte MessageEnd (0 = complete, 1 = aborted), included in the length prefix. To stay wire compatible with pre-1.0 senders, decode_frame also accepts frames without that byte, and treats them as complete.

Because an old frame has no end marker, its last byte is just message data, so the receiver cannot tell the two formats apart by looking at the last byte. decode_frame therefore has to:

  1. decode the message first,
  2. then look at what is left: nothing means an old frame (complete), one byte is the MessageEnd,
  3. and if the decode fails, drop the frame if its last byte happens to be 1 (Aborted).

This has two warts:

  • An aborted message is fully deserialized only to be thrown away.
  • A pre-1.0 frame that does not decode and happens to end in 1 is silently dropped instead of failing with MessageDecodeFailed (roughly 1 in 256 undecodable old frames). This is documented on decode_frame, but it is weird.

Once we no longer need to talk to pre-1.0 senders, we should require the end byte:

  • last byte 1: drop the frame without decoding it,
  • last byte 0: decode, and any decode failure is a real error,
  • no end byte / trailing garbage: protocol error.

This is a wire break for pre-1.0 senders, so it should come with a protocol version bump (e.g. a new ALPN) rather than land silently.

Related: #27

主要言語
Rust
スター
59
フォーク
10
平均マージ
3日 15時間
マージ済み PR(30日)
21

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

n0-computer/irpc のほかの issue

n0-computer/irpc の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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