session: a job's stop waits for the log-retention sweep, and publishing its end first races folder teardown
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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分
- マージ済み PR(30日)
- 775
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
[Docs] - Document minimum Terraform/OpenTofu version (>= 1.11) required by write-only argumentsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
MagaluCloud/terraform-provider-mgc#323 ·
メンテナーはふだん 11 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
rossoctl/context-guru#366 ·
メンテナーはふだん 1 日以内に返信
-
stage-fail
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
siyuan-note/bazaar#2293 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
piraeusdatastore/piraeus-operator#1070 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信