FA-1351 / Concurrency / Open access
Acquire a distributed mutex: Acquisition steals a currently held mutex · case 01
The distributed lock operation is admitted even though acquisition steals a currently held mutex.
ROOT CAUSE
The admission path omits the lock available invariant while validating the other operation preconditions.
VERIFIED REPAIR
Require r['lock_available'] is None together with every other stated precondition before accepting the operation.
Unsuccessful approach: Adding the lock available check repairs the reported defect, but replacing the adjacent waiter turn check loses that independent invariant.
Case contract
Return a Boolean admission decision for acquire a distributed mutex. The record r must satisfy all of: r['lock_available'] is None; r['waiter_turn'][0] == r['waiter_turn'][1][0]; r['owner_session'][0] < r['owner_session'][1]; r['fence_increase'][0] > r['fence_increase'][1]; r['lock_namespace'][0] == r['lock_namespace'][1]. Extra tracing fields are ignored; validation does not mutate the record.
Why this case matters
A deterministic local contract for concurrency. Each negative fixture violates exactly one invariant. No transport timing, persistence, cryptographic verification, or full protocol implementation is claimed.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
return (r['waiter_turn'][0] == r['waiter_turn'][1][0]) and (r['owner_session'][0] < r['owner_session'][1]) and (r['fence_increase'][0] > r['fence_increase'][1]) and (r['lock_namespace'][0] == r['lock_namespace'][1])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'lock_available': None, 'waiter_turn': ['a', ['a', 'b']], 'owner_session': [9, 10], 'fence_increase': [7, 6], 'lock_namespace': ['n1', 'n1']}
check('valid operation', solve(r), True)
check('Acquisition steals a currently held mutex', solve(dict(r, **{'lock_available': 'owner'})), False)
check('A newcomer bypasses the oldest eligible waiter', solve(dict(r, **{'waiter_turn': ['b', ['a', 'b']]})), False)
check('An expired session acquires a new mutex', solve(dict(r, **{'owner_session': [10, 10]})), False)
check('Reacquisition reuses the previous fencing token', solve(dict(r, **{'fence_increase': [6, 6]})), False)
check('A request acquires a lock in another coordination namespace', solve(dict(r, **{'lock_namespace': ['n2', 'n1']})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'lock_available': 'owner', 'waiter_turn': ['b', ['a', 'b']], 'owner_session': [10, 10], 'fence_increase': [6, 6], 'lock_namespace': ['n2', 'n1']}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| valid operation | True | True | Passed |
| Acquisition steals a currently held mutex | True | False | Failed |
| A newcomer bypasses the oldest eligible waiter | False | False | Passed |
| An expired session acquires a new mutex | False | False | Passed |
| Reacquisition reuses the previous fencing token | False | False | Passed |
| A request acquires a lock in another coordination namespace | False | False | Passed |
| unrelated tracing metadata | True | True | Passed |
| repeat validation is pure | True | True | Passed |
| two independent violations in variant | False | False | Passed |
SHA-256 / 95328248e292feb81a5783dba8c8e0b51c6f7d0418cdefd77c33addc5a0444c2
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
return (r['lock_available'] is None) and (r['owner_session'][0] < r['owner_session'][1]) and (r['fence_increase'][0] > r['fence_increase'][1]) and (r['lock_namespace'][0] == r['lock_namespace'][1])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'lock_available': None, 'waiter_turn': ['a', ['a', 'b']], 'owner_session': [9, 10], 'fence_increase': [7, 6], 'lock_namespace': ['n1', 'n1']}
check('valid operation', solve(r), True)
check('Acquisition steals a currently held mutex', solve(dict(r, **{'lock_available': 'owner'})), False)
check('A newcomer bypasses the oldest eligible waiter', solve(dict(r, **{'waiter_turn': ['b', ['a', 'b']]})), False)
check('An expired session acquires a new mutex', solve(dict(r, **{'owner_session': [10, 10]})), False)
check('Reacquisition reuses the previous fencing token', solve(dict(r, **{'fence_increase': [6, 6]})), False)
check('A request acquires a lock in another coordination namespace', solve(dict(r, **{'lock_namespace': ['n2', 'n1']})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'lock_available': 'owner', 'waiter_turn': ['b', ['a', 'b']], 'owner_session': [10, 10], 'fence_increase': [6, 6], 'lock_namespace': ['n2', 'n1']}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| valid operation | True | True | Passed |
| Acquisition steals a currently held mutex | False | False | Passed |
| A newcomer bypasses the oldest eligible waiter | True | False | Failed |
| An expired session acquires a new mutex | False | False | Passed |
| Reacquisition reuses the previous fencing token | False | False | Passed |
| A request acquires a lock in another coordination namespace | False | False | Passed |
| unrelated tracing metadata | True | True | Passed |
| repeat validation is pure | True | True | Passed |
| two independent violations in variant | False | False | Passed |
SHA-256 / 4a10302feb480bc11dd1d8e37fb191f507b4e97b402c9300194d88b1aa3009b2
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(r):
return (r['lock_available'] is None) and (r['waiter_turn'][0] == r['waiter_turn'][1][0]) and (r['owner_session'][0] < r['owner_session'][1]) and (r['fence_increase'][0] > r['fence_increase'][1]) and (r['lock_namespace'][0] == r['lock_namespace'][1])
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
r = {'lock_available': None, 'waiter_turn': ['a', ['a', 'b']], 'owner_session': [9, 10], 'fence_increase': [7, 6], 'lock_namespace': ['n1', 'n1']}
check('valid operation', solve(r), True)
check('Acquisition steals a currently held mutex', solve(dict(r, **{'lock_available': 'owner'})), False)
check('A newcomer bypasses the oldest eligible waiter', solve(dict(r, **{'waiter_turn': ['b', ['a', 'b']]})), False)
check('An expired session acquires a new mutex', solve(dict(r, **{'owner_session': [10, 10]})), False)
check('Reacquisition reuses the previous fencing token', solve(dict(r, **{'fence_increase': [6, 6]})), False)
check('A request acquires a lock in another coordination namespace', solve(dict(r, **{'lock_namespace': ['n2', 'n1']})), False)
check('unrelated tracing metadata', solve(dict(r, trace='run-'+str(N))), True)
check('repeat validation is pure', solve(r), True)
invalid = {'lock_available': 'owner', 'waiter_turn': ['b', ['a', 'b']], 'owner_session': [10, 10], 'fence_increase': [6, 6], 'lock_namespace': ['n2', 'n1']}
keys = list(invalid)
pair = {keys[N % len(keys)]: invalid[keys[N % len(keys)]], keys[(N+1) % len(keys)]: invalid[keys[(N+1) % len(keys)]]}
check('two independent violations in variant', solve(dict(r, **pair)), False)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| valid operation | True | True | Passed |
| Acquisition steals a currently held mutex | False | False | Passed |
| A newcomer bypasses the oldest eligible waiter | False | False | Passed |
| An expired session acquires a new mutex | False | False | Passed |
| Reacquisition reuses the previous fencing token | False | False | Passed |
| A request acquires a lock in another coordination namespace | False | False | Passed |
| unrelated tracing metadata | True | True | Passed |
| repeat validation is pure | True | True | Passed |
| two independent violations in variant | False | False | Passed |
SHA-256 / b690aef6b92e649c3e63efe9b4f1ebb2872a0ddc6f001f4352256f570c8f0188
Verification & scope
This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:37:01.485012+00:00.
Case digest / fc9a949c34819c6e95befc3ccd15a32b470c53fb03c91628461a8da5130c6324