session: a job's stop waits for the log-retention sweep, and publishing its end first races folder teardown
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- go
调研方向
Start with job.settle and jobSink.close in internal/session/jobs.go, searching for retention, then read the sweep in internal/session/jobretention.go and the wait logic in internal/session/task_job_park_test.go. Run the two named tests with GOMAXPROCS=2 under load. Done means job stopping no longer waits on retention, observers cannot race folder teardown, retention and shutdown behavior remain tested, and the new folder-removal test passes.
由索引模型根据 Issue 内容生成。
描述
What happened
Since #1603 (log retention, in #1627), a job's ending runs the whole log-folder retention sweep before the job's status leaves running. Under load, a stopped job reads as running for 47–130 ms, against about 2 ms before. TestStopWorkDoesNotWakeAndOnlyFreshSubmissionRestarts fails 5 of 20 runs under load on #1627's head 6cc872c8e, and 0 of 20 on dev 837b2b06a.
The obvious fix, publishing the final status first and then sweeping, was tried on #1627 (8b0edfd6d) and reverted (2e007e33b). Anything that watches running() then removes the job's folder while the sweep is still writing in it. CI:
--- FAIL: TestAParkedWorkerIsHandedBackWithARecordBeforeItsWholeAllowance (1.05s)
testing.go:1464: TempDir RemoveAll cleanup: unlinkat …/003/.codeaf/jobs: directory not empty
waitSettled in internal/session/task_job_park_test.go polls !one.running(). Giving a task's copy back after its jobs end has the same shape in the product.
Replication
Deterministic (no model). On #1627's head, loaded (run beside another package's tests, or with GOMAXPROCS=2):
go test -run '^TestStopWorkDoesNotWakeAndOnlyFreshSubmissionRestarts$' -count=20 ./internal/session
A few runs fail. With 8b0edfd6d applied instead, run
-run '^TestAParkedWorkerIsHandedBackWithARecordBeforeItsWholeAllowance$' -count=50 under the same load. It fails on the TempDir cleanup.
Where
job.settleandjobSink.closeininternal/session/jobs.go(searchretention)- the sweep in
internal/session/jobretention.go
The fix
A job's stop is not slowed by retention, and no observer of a job's end can race the sweep. One way to get both: the sweep stops being part of any single job's ending. It runs as one registry-owned pass, which shutdown and the registry's close join, and which tolerates its directory disappearing. Test helpers that wait for a job's end wait on done, not on running().
Acceptance
- Unit:
TestStopWorkDoesNotWakeAndOnlyFreshSubmissionRestartspasses 50/50 underGOMAXPROCS=2with another package's tests running beside it. - Unit:
TestAParkedWorkerIsHandedBackWithARecordBeforeItsWholeAllowancepasses 50/50 under the same load. - Unit: a new test ends a job and immediately removes its jobs folder, as a copy's give-back does, and nothing is written into it afterwards.
- Unit: a new test proves retention still bounds the folder (the #1599 law) and that shutdown still joins a sweep in progress.
- 主要语言
- Go
- 星标
- 115
- 派生
- 14
- 平均合并
- 9 小时 44 分钟
- 30 天内合并 PR
- 775
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Agent-Field/CodeAF 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
Agent-Field/CodeAF#1679 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
Agent-Field/CodeAF#1678 ·
维护者通常 1 天内回复
-
area:chat bug sev:papercut
难度 2/5 1-3 小时 新手友好度 86/100
Agent-Field/CodeAF#1592 ·
维护者通常 1 天内回复
-
codeaf do "" runs a paid job with an empty brief可能已有人在做 @santoshkumarradha 于 3 天前认领。 未关闭area:headless bug sev:critical
难度 2/5 1-3 小时 新手友好度 88/100
Agent-Field/CodeAF#1566 · 已指派 1 人 ·
维护者通常 1 天内回复
-
area:chat feature
难度 2/5 1-3 小时 新手友好度 88/100
Agent-Field/CodeAF#1510 ·
维护者通常 1 天内回复
查看 Agent-Field/CodeAF 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
NVIDIA/k8s-device-plugin#2076 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
area/release kind/bug
难度 2/5 1-3 小时 新手友好度 82/100
kubernetes-sigs/kueue#16455 · 1 条评论 ·
维护者通常 1 天内回复