Http2Stream::do_io_write sets up the write VIO, then returns nullptr when the stream is not writeable

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

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

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

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp

調査の方向性

Read Http2Stream::do_io_write in src/proxy/http2/Http2Stream.cc around lines 551–573, then inspect main_event around lines 231–237 to understand how write events use write_vio. Check existing HTTP/2 stream tests for coverage of writes on non-writeable streams. Done when that path cannot leave a caller-bound VIO or reader behind after returning nullptr, and the relevant tests pass.

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

説明

Bug HTTP/2

Http2Stream::do_io_write assigns the reader, mutex, cont, nbytes, ndone, vc_server and op = VIO::WRITE to write_vio, and stores the reader in _send_reader. Only after that does it check is_state_writeable() and return nullptr for a stream that can't be written (Http2Stream.cc#L551-L573).

The caller sees a failed write and holds no VIO. The stream, however, now has an active write VIO bound to the caller's continuation and an alias of the caller's reader. Nothing prevents later write events from going out: main_event forwards VC_EVENT_WRITE_READY/WRITE_COMPLETE for &write_vio to write_vio.cont (Http2Stream.cc#L231-L237). So the caller can get callbacks for a VIO it was never given. And if the caller frees its buffer because the write "failed", _send_reader dangles.

I have not traced a specific in-tree sequence that leads to a callback or a dereference after the nullptr return. The inconsistency is in the function itself.

Suggested fix: check is_state_writeable() before modifying write_vio and _send_reader, or reset them before returning nullptr.


generated with Claude Opus 5.5 by Josiah VanderZee

主要言語
C++
スター
2k
フォーク
903
平均マージ
4日 4時間
マージ済み PR(30日)
135

環境構築

はじめの一歩

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

apache/trafficserver のほかの issue

apache/trafficserver の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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