TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative period

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

维护者通常 2 天内回复

@rajeetvk 已经在做这个了。

开始于 2026年12月5日。

  • #14281 来自 @rajeetvk —— 未关闭

评估

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

调研方向

从 src/api/InkAPI.cc 中的 TSContScheduleEveryOnPool()、TSContScheduleEveryOnThread() 和 TSContScheduleEveryOnEntirePool() 开始。将它们对周期的验证与文档中周期必须为正数的要求进行比较。针对周期为零和负数的情况添加或更新专门的测试,然后验证每个 API 都能一致地拒绝这些值。

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

描述

Bug Event System Good First Issue TS API

TSContScheduleEveryOnPool() and TSContScheduleEveryOnThread() pass every to the core scheduler without checking it (InkAPI.cc#L4046, InkAPI.cc#L4073). TSContScheduleEveryOnEntirePool() does check, with sdk_assert(every != 0) (InkAPI.cc#L4088), and the docs describe every as a period in milliseconds, so a non-positive value is caller error that should be rejected.

What happens instead:

  • Negative every. EventProcessor::schedule_every() and EThread::schedule_every() treat a negative period as a request for a polling event (UnixEventProcessor.cc#L783, UnixEThread.cc#L536). The event goes on the thread's negative queue and runs on every pass of the event loop with EVENT_POLL (5) (UnixEThread.cc#L346). The plugin's continuation is called continuously, with an event code that isn't a defined TSEvent.
  • Zero every. EventProcessor::schedule_every() has only a debug ink_assert(t != 0) (UnixEventProcessor.cc#L774), and EThread::schedule_every() has none. In release builds the event is initialized with period 0, so it fires once as a one-shot rather than repeating.

Suggested fix: sdk_assert(every > 0) in both functions, and the same check in TSContScheduleEveryOnEntirePool(). That function currently rejects zero but not negative values.


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