test(pkg): expose revision-store lock inode race - #16171
Draft
Alizter wants to merge 1 commit into
Draft
Conversation
Alizter
force-pushed
the
repro/rev-store-lock-contention
branch
from
August 24, 2026 14:21
e658e15 to
7987f25
Compare
Add a Linux-only cram regression that drives two Dune package-lock processes through Rev_store.load_or_create with a shared fresh cache. A fake git and FIFO barriers deterministically queue the second process on the first process's lock inode, then hold it in rev-store validation. A third nonblocking contender verifies that the canonical lock path still refers to the held inode. The correct mutual-exclusion expectation intentionally fails on main: with_flock unlinks rev-store.lock before unlocking it, so the queued second process holds an unlinked inode while the third process locks a new inode at the canonical path. Signed-off-by: Ali Caglayan <alizter@gmail.com>
Alizter
force-pushed
the
repro/rev-store-lock-contention
branch
from
August 24, 2026 15:47
7987f25 to
ceac1d5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a Linux-only cram regression for the revision-store lock inode race.
Two
dune pkg lockprocesses share a fresh cache. A fakegit, FIFO barriers, and/proc/<pid>/fddeterministically queue the second process on the first process's lock inode, wait until the first owner has finished cleanup, and then hold the second process insideRev_store.load_or_create. A third nonblockingflockon the canonical path must still contend with that owner.All readiness and exit waits are bounded. Failure cleanup releases FIFO readers, kills, and reaps the spawned Dune processes.
util-linuxis added only to the Linux test environment to provide the externalflockprobe.This is intentionally a test-only draft. The expected mutual-exclusion behavior remains in the cram, so the new test is red on
main.Current Failure
with_flockunlinksrev-store.lockbefore releasing its flock. The queued second process subsequently owns the unlinked original inode while the third process creates and locks a replacement inode at the canonical path, entering the revision-store critical section concurrently.Related Issue and Motivation
#9140 added the revision-store lock to prevent concurrent processes from corrupting the shared bare repository. This test isolates an inode-lifetime hole in that locking contract before any production fix is proposed.
Verification
nix develop path:. -c dune fmtpassed.nix develop path:. -c dune build @checkpassed.rev-store-lock-linux.tandrev-store-lock.tpassed.Checklist