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
fix(pm): stop --report labelling the arrival depth as "waiters already ahead" (#12782) (#12822)
The depth is read AFTER take_ticket has minted this call's own ticket, so the
recorded value is the arriving run PLUS the waiters ahead of it and its floor
is 1. --report printed it under "queue depth on arrival (waiters already
ahead)", so a completely uncontended fleet read as one waiter deep on every
row, and a reader had no way to tell whether the label or the record was the
wrong one.
The record was never wrong -- announce_arrival already derives
`ahead = depth - 1` from the same number and says "0 ahead of you" on a free
lock -- so this repairs the heading and leaves the recording path byte-for-byte
untouched. Rewriting the field instead would put a meaning boundary through the
middle of a ledger nothing can re-date, which is the mixed-population hazard
--report already has to warn about for `command-exit`.
Measured on a private lock and ledger, one holder plus two waiters: the holder
and the first waiter both record depth=1 (a holder deletes its ticket when it
acquires, so it is not in the queue either), and the second waiter records
depth=2 while its arrival line says "1 ahead of you". That second reading is
why the heading gained a second note: depth=1 is evidence about the QUEUE and
says nothing about whether the lock was held.
Self-test pins the record at its floor (an uncontended acquire records depth=1)
so a later "fix" that subtracts one in the recording path goes red, and pins
that the off-by-one heading is gone rather than merely annotated.
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments