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

未关闭
#14,222 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
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 小时
30 天内合并 PR
135

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/trafficserver 的其他 Issue

查看 apache/trafficserver 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。