UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIO

未关闭 适合新手
#14,220 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@NginxL 已经在做这个了。

开始于 2026年12月5日。

  • #14285 来自 @NginxL —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
cpp

调研方向

阅读 src/iocore/net/UnixNetVConnection.cc,比较 do_io_write 中 reader 为 null 的分支与 do_io_read 清空缓冲区的处理。当 reader 为 null 时清空写入 VIO 缓冲区,然后检查相关网络测试中的取消行为,并确认 get_reader() 不再暴露旧 reader。

由索引模型根据 Issue 内容生成。

描述

Bug Good First Issue IOBuffer Network

UnixNetVConnection::do_io_read clears the read VIO's buffer when it is called without a buffer (UnixNetVConnection.cc#L220). do_io_write does not do the same. When reader is null it only clears write.enabled (UnixNetVConnection.cc#L245-L247), so write.vio.buffer keeps pointing at the reader, and the MIOBuffer, from the previous write.

The common way to cancel a write is do_io_write(nullptr, 0, nullptr), and the caller then often frees its buffer. HttpSM::state_raw_http_server_open is one example. It starts a one-byte write with _netvc_reader (HttpSM.cc#L1193), then cancels it and frees the MIOBuffer the reader belongs to (HttpSM.cc#L1205-L1206). From then until the next do_io_write, the VC's write VIO holds a dangling reader and MIOBuffer.

Today the net code doesn't dereference the stale reader on these paths, because nbytes is 0 and writing is disabled, but nothing enforces that, and get_reader() on that VIO returns freed memory.

Suggested fix: clear write.vio.buffer in the reader == nullptr branch, as do_io_read already does.


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 摘要。