UnixNetProcessor::connect_re leaks the NetVC when no SOCKS server is available

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

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

阅读 src/iocore/net/UnixNetProcessor.cc 第 193 行及第 224–230 行附近的代码,然后检查 src/iocore/net/Socks.cc 第 157–165 行附近的代码,跟踪失败时的清理流程。检查相邻的返回路径如何释放 vc,并确认 SOCKS 初始化失败时会在返回前释放它。无可用 SOCKS 服务器的路径释放已分配的 NetVC,且相关测试通过后,即视为完成。

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

描述

Bug Leak Network SOCKS

UnixNetProcessor::connect_re allocates the UnixNetVConnection up front (UnixNetProcessor.cc#L193) and sets vc->mutex = cont->mutex. When SOCKS is in use but SocksEntry::init() finds no usable SOCKS server, the function frees the SocksEntry and returns ACTION_RESULT_DONE (UnixNetProcessor.cc#L224-L230).

SocksEntry::free() reports NET_EVENT_OPEN_FAILED to the caller, but it only closes netVConnection, which is still null at this point (Socks.cc#L157-L165). SocksEntry::init() never stores vc. Nothing frees vc, so every such connect leaks a NetVC, and with it a reference to the caller's mutex.

This happens for every SOCKS-routed origin connect while all SOCKS servers are marked down or none is configured for the destination.

The fix is to free vc on this path (for example vc->free_thread(t)) before returning.


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