Skip to content

[finding] os-verify-lock: the header invariant "headship is stable — the ones ahead of you can only disappear" is falsified by slot resume; a resumed slot cannot displace the incumbent head #15581

Description

@baozhoutao

Filed unassigned by the domain:devx execution seat while measuring #14944. Observation class — recording a gap between a stated invariant and measured behaviour, not proposing a ruling. domain:*, type and priority are triage's.

The stated invariant

scripts/pm/os-verify-lock.sh's ordering block justifies head-only flock with this sentence, written by the commit that introduced the ticket queue (47c1021, #9921, 2026-08-19):

Only the ticket at the HEAD of the live queue ever calls flock; everyone else polls. Head-only means no thundering herd, and headship is stable — tickets sort by arrival and the ones ahead of you can only disappear.

Six days later the slot mechanism landed (c312a56, #12335, 2026-08-25). A parked ticket keeps its ORIGINAL arrival stamp and is excluded from the live queue while parked; on resume it re-enters the live queue at that stamp. ⇒ A ticket ahead of you can now APPEAR, not only disappear. The sentence was true when written and has not been revisited since.

What that costs, measured

Isolated experiment, private lock file and ledger via OS_VERIFY_LOCK_FILE / OS_VERIFY_LOCK_LEDGER — the shared /tmp/os-heavy-verify.lock and its ledger were untouched, so this distorts no fleet reading.

Setup: one holder; a polite slot waiter that times out and parks; newcomer A arriving next (becomes head, enters the flock slice loop); newcomer B arriving after A (position 2, polling); then the polite waiter RETURNS with its slot, stamp older than both.

resumed slot 'polite' — keeping the place it took 14s ago
arrival order: newcomerA (t+0), newcomerB (t+3), returner (t+6, stamp ~t-9)
acquisition order observed:
  ACQ newcomerA 1788559926.58
  ACQ returner  1788559927.61
  ACQ newcomerB 1788559928.66

The slot resume works, with exactly one bounded exception. The returner beat newcomer B — the place is genuinely delivered against every waiter that is merely polling. It could NOT displace newcomer A, which was already blocked inside flock and is never revisited: once a caller breaks out of the queue loop at pos == 1 it re-checks the clock and the slice budget each pass, but never re-checks whether it is still the head.

A two-party control run (same harness, slot-set leg against a control-no-slot leg) produced identical acquisition order in both legs, which is the same reading from the other side: against the incumbent head alone, naming a slot buys nothing.

Why it is worth recording rather than fixing on sight

⇒ So the cheapest true statement may simply be to correct the header: headship is stable EXCEPT against a resuming slot, and a resuming slot cannot displace an incumbent head. Both halves are measured above; neither is currently written down.

Reproduction

scripts/pm/os-verify-lock.sh --self-test        # unaffected, green

Then the isolated three-party harness described above, driven with OS_VERIFY_LOCK_FILE, OS_VERIFY_LOCK_LEDGER, OS_VERIFY_LOCK_BOOTS and OS_VERIFY_LOCK_NO_FILTER_CHECK=1, holders written as sleep.

Reverse-check any zero reading against a term known present in the same file — git grep -n "VERDICT" -- scripts/pm/os-verify-lock.sh returns many hits — so a zero is a reading rather than a broken probe.

Refs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions