Skip to content

bug: Squid 304 revalidation reproduction + deploy debug options - #20

Open
ccijunk wants to merge 2 commits into
mainfrom
bug/304bug-deploy
Open

bug: Squid 304 revalidation reproduction + deploy debug options#20
ccijunk wants to merge 2 commits into
mainfrom
bug/304bug-deploy

Conversation

@ccijunk

@ccijunk ccijunk commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

变更内容

  • 304BUG/:Squid TCP_REFRESH_UNMODIFIED_ABORTED(304 + Content-Length: 0)问题复现工具
    • reproduce.sh 支持 --no-purge 模式(对自然过期的缓存条目做重验证,freshness lifetime ≈ 80.8 分钟)
    • vcjob-reproduce.yaml(Volcano 测试任务)、README.md / SUMMARY.md / EXECUTION_LOG.md
  • deploy/chart/templates/configmap.yaml:新增 debug_options ALL,1 11,2 20,3 28,3 88,3 用于排查 revalidation 中断问题
  • deploy/:与 product-sample-test 分支对齐(CACHE-STRATEGY.md、gy-001/002/wlcb values、去掉 tool/ 测试)

说明

  • main 分支已不再跟踪 gy-001/wlcb-001 的 values 文件,此处有意不携带这些变更。
  • 已确认根因:OBS 在条件请求上返回 304 Not Modified 且带 Content-Length: 0
  • Bug 真实影响:客户端收到 200 OK + Content-Length: 0(证据:TCP_REFRESH_UNMODIFIED_ABORTED/200,wget saved [0/0],exit 0)。HTTP 客户端不会在 200 时重试,因此这是静默数据损坏:CI 下载到 0 字节产物,直到解压步骤才失败(tar: Error is not recoverable)。

上游分析

该问题在上游由 squid-cache/squid#2401 跟踪 — Bug 5538: Do not update Content-Length from 304 responses。下面两个上游 PR 目前均为 open、未合入,Squid master 上 bug 仍然存在。

  • RFC 9111 §3.2 明确将 Content-Length 排除在"缓存从 304 更新存储响应时必须采纳(替换已有值)的头部"之外。有缺陷的服务器在 304 中带 Content-Length: 0,否则会替换掉正确的已存长度,导致向客户端下发空 body。
  • #2401 在"如何更新"层修复:HttpHeader::skipUpdateHeader()VARY 之外跳过 CONTENT_LENGTH。维护者反馈:这只是针对单一症状的创可贴。
  • #2400(维护者更倾向、更全面的方案)在"是否更新"层修复(RFC 9111 §4.3.4):重写后的 needUpdate()Content-LengthETagContent-TypeContent-EncodingVary 当作强表示标识符——若 304 的值与已存储的不一致,则整体拒绝该 304,其头部(包括伪造的 Content-Length: 0)一概不应用。同时还能防护 #2401 覆盖不到的 Vary/Content-Type/Encoding 不匹配场景。
  • 对我们的 OBS 场景,客户端可见结果完全一致:#2401 和 #2400 都会让 Squid 下发存储的完整 body(已存 Content-Length: 202104)——不会回源重下,也不会出现 0 字节响应。
  • 落地建议:#2401 是一行级 backport(skipUpdateHeader 增加 CONTENT_LENGTH),与当前部署的 Squid 版本兼容,适合快速止血;#2400 是更正确的长期上游修复。

本 PR 记录了复现过程、用于诊断问题的 debug 选项,以及针对我们 Squid 部署的上游分析。

@opensourceways-bot

Copy link
Copy Markdown

Welcome To opensourceways Community

Hey @ccijunk , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: infratructure ,
and any of the maintainers: @GeorgeCao-hw, @TangJia025, @pkking, @zhongjun2 ,
and any of the committers: @TommyLike, @ccijunk, @happyaron, @pkking .

@opensourceways-bot

Copy link
Copy Markdown

CLA Signature Pass

ccijunk, thanks for your pull request. All authors of the commits have signed the CLA. 👍

@opensourceways-bot

Copy link
Copy Markdown

Linking Issue Notice

@ccijunk , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants