poteto-mode orch store: stale-lock takeover can delete a live lock and admit two writers
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
- 領域
- tooling
研究方向
Start in scripts/orch/store.ts at acquireLock around :385-430, especially the EEXIST path and the unconditional unlink in takeOver at :394; also inspect --force handling. Reproduce the interleaving with the in-memory filesystem approach described, then design recovery serialization and a per-acquisition token checked by release and takeover. Done means the two-acquirer/one-stale-holder schedule admits at most one writer and the regression test asserts that.
由索引模型根據 Issue 內容生成。
描述
Found against pstack 0.15.34 at cursor/plugins 519d36aa98955bf680db01bcde5fdfba686dc901 (harness/pstack/claude-code/skills/poteto-mode/). Line numbers refer to that commit.
scripts/orch/store.ts (acquireLock, around :385-430) recovers a stale lock like this:
open(path, "wx")fails withEEXIST.- It reads the holder PID, and
holderIsDead(holder)is true. takeOver()callsunlink(path)unconditionally (:394), thencreate()again.
Between steps 2 and 3, another process can take over the same stale lock and create its own lock file. The slower
process then unlinks that new, live lock and creates its own. Both believe they hold the lock. The same applies to
--force (options.force). Every store write is a whole-file read-modify-write (unit updates, ledger records, gates,
standing orders), so two writers lose updates: units or verification records disappear.
Repro (executed in a no-write harness, using the transpiled acquireLock body over an in-memory filesystem):
A and B both fail create() with EEXIST and read the same dead holder PID.
A: unlink, create -> A holds the lock.
B resumes: unlink (deletes A's live lock), create -> B holds the lock too.
Suggested fix:
- Serialize recovery with a separate exclusive mechanism, such as an OS advisory lock (
flock) or a separate
wx-created recovery lock that is itself removed only by its creator. - Write a unique token with each acquisition (pid plus random nonce plus time), and have release and takeover check
that token instead of only the PID. - Rereading the holder just before the
unlinknarrows the window but doesn't close it. - Add a concurrency regression test for the schedule above: two acquirers, one stale holder, interleaved
read/unlink/create. Assert that at most one acquirer succeeds.
- 主要語言
- TypeScript
- 星號
- 18.2k
- 分支
- 2k
- 平均合併
- 4 小時 20 分鐘
- 30 天內合併 PR
- 80
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
cursor/plugins 的其他 Issue
-
pstack correct: a check behind an opt-in switch should count as unshipped until the switch is on未關閉
難度 1/5 1 小時以內 新手友好度 78/100
維護者通常 1 天內回覆
-
pstack: interrogate asks the user, which worker.md forbids for delegates that reach it可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
poteto-mode: multi-phase-plan Merge placeholder still appends every PR to a base-branch stack可能已有人在做 @mangeshraut712 於 15 天前認領。 未關閉
難度 1/5 1 小時以內 新手友好度 78/100
維護者通常 1 天內回覆
-
typescript-best-practices: schema example uses z.string().uuid(), deprecated in Zod 4可能已有人在做 @mangeshraut712 於 14 天前認領。 未關閉
難度 1/5 1 小時以內 新手友好度 88/100
維護者通常 1 天內回覆
-
statechart: relative-symlink launcher test fails on macOS because /var is a symlink可能已有人在做 @lnuxe 於 3 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
相似的 Issue
-
infra needs-triage
難度 2/5 1 小時以內 新手友好度 82/100
LucasSantana-Dev/Lucky#3331 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
kOaDT/oss-oopssec-store#381 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
nocobase/nocobase#11669 · 1 則留言 ·
維護者通常 1 天內回覆
-
iOS: Clear Context (/clear) and model picker fallback use negative agent check instead of isClaude未關閉
難度 2/5 1-3 小時 新手友好度 62/100
維護者通常 1 天內回覆
-
Area: API Bug Difficulty: Low Priority: Low
難度 2/5 1-3 小時 新手友好度 62/100
DouglasNeuroInformatics/OpenDataCapture#1937 ·
維護者通常 1 天內回覆