You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
substore: TestConcurrentMintsNeverShareAVersion fails under full-tree load — writers lose or share minted versions #274
internal/substore TestConcurrentMintsNeverShareAVersion fails under full-tree parallel load and passes standalone, which is the signature of a real concurrency hole with a test that only finds it under contention:
--- FAIL: TestConcurrentMintsNeverShareAVersion
2 of 8 writers minted a version
Observed 2026-09-01 on Linux during go test ./... at the head of PR #254's branch (which touches nothing internal/substore reads — the failure reproduces the same way on a stashed clean tree). Standalone, go test ./internal/substore/ -run TestConcurrentMintsNeverShareAVersion -count=3 is green on the same machine.
The test's own name states the invariant: two writers must never share a minted version. "2 of 8 writers minted" under load means six writers either lost their mint silently or shared one — either is a store-level correctness hole, not a test artifact. It is not on .github/known-red.txt, and per the ledger's rule it should not be added there: a load-dependent invariant violation is a bug report, not a known shape.
Replication
go test ./... 2>&1 | grep -A2 TestConcurrentMintsNeverShareAVersion # under full parallel load
go test ./internal/substore/ -run TestConcurrentMintsNeverShareAVersion -count=3 # green standalone
If the full-tree run does not reproduce it first try, go test ./internal/substore/ -run TestConcurrentMintsNeverShareAVersion -count=20 -parallel 1 alongside a concurrent go test ./internal/session/ tends to recreate the starvation window; failing that, stress the package test while the machine builds.
Acceptance
The root cause is named: which mint path can lose or share a version when the scheduler starves a writer (suspects: an flock retry with a bounded wait treated as success-shaped, a version read-check-write outside the lock, or an O_EXCL claim retried on the same computed version).
The invariant holds under load: the standalone test green with -count=20, and green in a full go test ./... on a busy machine, three consecutive runs.
If the fix reveals the test was mis-counting rather than the store mis-minting, the test is fixed and the entry here says why the store was never wrong.
Drafted with CodeAF · reviewed and owned by the author
Follow-up landed: #310 bounds the mint gate added in #306 — non-blocking flock retried under a 2 s deadline (hundreds of times the measured worst contention), then a typed ErrMintBusy refusal rather than an unbounded wait or an unlocked fall-through. A caller wired onto a turn path gets an answer within the bound, never a freeze (the #264 class).
Activity
substore: one mint at a time, so a lineage cannot fork
substore: one mint at a time, so a lineage cannot fork
substore: one mint at a time, so a lineage cannot fork (#306)
santoshkumarradha commentedon Sep 2, 2026
Follow-up landed: #310 bounds the mint gate added in #306 — non-blocking flock retried under a 2 s deadline (hundreds of times the measured worst contention), then a typed
ErrMintBusyrefusal rather than an unbounded wait or an unlocked fall-through. A caller wired onto a turn path gets an answer within the bound, never a freeze (the #264 class).