Repository navigation
Recheck shared disk headroom during SForge research collection - #9319
Conversation
Signed-off-by: huangruiteng <huangrt01@163.com>
huangruiteng
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-astra · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
共享 runner 上的操作者需要在容器结束时收回研究文件,也要给同时工作的其他进程留下磁盘空间。原来只在下载前看一次磁盘。即使另一个进程在下一块数据到来前占掉了余量,收集器仍会写出成功回执。现在余量不足会中止研究归档并写明原因。普通日志和会话文件仍各自完成收集,归档数据流会关闭。这次修复限定在终态研究文件的收集,保留原有评分、提交范围、检查点和 10 GiB 阈值。
改动思路 / Approach
此处需要在真正要写入时读取磁盘状态。下载和解包都沿用已有的 Docker 收集入口与同一种容量错误。修复只影响可选的研究归档,普通产物继续使用原有的 tar 提取路径和回执。 下载时每一块写入前都读当前余量,解包时先检查整份保留数据能否放下,再在复制文件内容时检查下一块是否还放得下。这样能覆盖同一大文件解包到一半时,其他进程突然占满共享盘的情况。
具体改动 / Changes
关键代码讲解
- 研究包的临时文件使用无缓冲写入。下一次检查可以看到上一块已占用的空间,把两个目标位置的实际可用空间和下一笔写入量进行比较。旧实现只扣除自己预计写过的字节,遗漏了其他进程的写入。当前磁盘余量判断
- tar 模块继续处理解包、权限和硬链接。保留成员的文件内容通过一个小型读取器流入解包器,每次复制都可触发原有的容量异常。退出时恢复原读取器并关闭数据流,收集器仍能记录具体产物的完成情况。读取解压后的内容 · 原生收集入口
- 下载中途、准备解包、大文件复制途中三个用例在主干版本全部失败,修复后全部通过。其他五类产物的回执独立验证。原来的会话目录测试现在显式提供充足容量,能在低余量开发机上稳定验到它真正关心的路径和内容。阶段回归用例
以上覆盖原评审 6020878324 的两条验收条件 live-headroom 与 cleanup-readback。#9243 (review)
对主干的风险 / Risks
语义与 CI 对齐
真实 Docker 对照中,另一个进程在第一块下载后写入了 48 MiB,磁盘空间降至测试阈值以下约 36 MiB。主干仍给出成功回执,此提交给出容量不足回执,并关闭数据流。两边的其他五项归集均成功。在空间稳定的对照运行里,同一对硬链接和原有内容均得到保留。对照只缩放测试阈值,生产阈值仍为 10 GiB。
318 项相关测试全部通过。预合并的 5 项直接检查和 9 项选中检查自动执行零失败,benchmark 敏感路径单独用原生容器核对。额外的磁盘读取有运行成本。容量检查与单次写入之间仍有竞态,解包失败可能留下部分私有文件,使用者应以该项成功回执判断完整性。
我的整体评价 / Verdict
用户通过本地文件和收集回执查看结果,本次变更没有渲染页面。 这次直接修复了共享存储当场变化时的错误成功信号,保留了稳定容量下可交付的文件和其他产物的独立结果。修复范围集中在 SForge 的本地文件传输,真实容器给出的失败和恢复条件均可观察。
English verdict: APPROVE at 7a4e05a74fb9860837947b4acdc404b24f55ad71. Real Docker collection refused shared-disk pressure, preserved ordinary artifacts and passed the stable-space control. The scoped regressions and automated premerge checks passed.
Problem
Follow-up to #9243 and its shared-runner storage finding. SForge estimated remaining disk capacity from a single reading taken before downloading a research archive. A second process could consume space while collection was in progress, and the optional research artifact could still be reported as collected.
Change
Read current free space on the spool and destination volumes before each research download write, before extraction, before copying each uncompressed file block and before reporting success. Unbuffered spool writes make the preceding allocation visible to the next sample. The existing extraction filter, hardlink handling, 10 GiB floor and per-artifact failure receipt continue to apply. This is a sampled guard; other processes can allocate between a check and the filesystem write.
The session-home collection test now supplies explicit sufficient capacity for its success scenario. Three new failure cases exercise a drop between download chunks, after spooling, and partway through a retained file. Each checks the refusal receipt, stream closure and the other artifact results.
Verification
7a4e05a74fb9860837947b4acdc404b24f55ad71. All three new cases failed with the merged fix(runtime,benchmark): ignore Linux zombie groups and harden worker hygiene #9243 collector, then passed with this change. The affected SForge, archive and research suites passed all 318 tests.