FAILURE MAP
← Case archive

FA-1366 / Concurrency / Open access

Acquire a distributed mutex: Reacquisition reuses the previous fencing token · case 01

The distributed lock operation is admitted even though reacquisition reuses the previous fencing token.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The admission path omits the fence increase invariant while validating the other operation preconditions.

VERIFIED REPAIR

Require r['fence_increase'][0] > r['fence_increase'][1] together with every other stated precondition before accepting the operation.

Unsuccessful approach: Adding the fence increase check repairs the reported defect, but replacing the adjacent lock namespace 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['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['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 fixtureActualExpectedOutcome
valid operationTrueTruePassed
Acquisition steals a currently held mutexFalseFalsePassed
A newcomer bypasses the oldest eligible waiterFalseFalsePassed
An expired session acquires a new mutexFalseFalsePassed
Reacquisition reuses the previous fencing tokenTrueFalseFailed
A request acquires a lock in another coordination namespaceFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / 48872a937f2439bb4d179c2f23cfae241e8f8b4df3507825d297aa3272c46b7d

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['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])
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 fixtureActualExpectedOutcome
valid operationTrueTruePassed
Acquisition steals a currently held mutexFalseFalsePassed
A newcomer bypasses the oldest eligible waiterFalseFalsePassed
An expired session acquires a new mutexFalseFalsePassed
Reacquisition reuses the previous fencing tokenFalseFalsePassed
A request acquires a lock in another coordination namespaceTrueFalseFailed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

SHA-256 / 90a7e85e3b4b559680f11ed78579a65d29f83908ba249be5992568e8a7e57cce

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 fixtureActualExpectedOutcome
valid operationTrueTruePassed
Acquisition steals a currently held mutexFalseFalsePassed
A newcomer bypasses the oldest eligible waiterFalseFalsePassed
An expired session acquires a new mutexFalseFalsePassed
Reacquisition reuses the previous fencing tokenFalseFalsePassed
A request acquires a lock in another coordination namespaceFalseFalsePassed
unrelated tracing metadataTrueTruePassed
repeat validation is pureTrueTruePassed
two independent violations in variantFalseFalsePassed

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.645575+00:00.

Case digest / 3a39dbdd678c827c71836568cd27fd2191c75f0401b9795ecb4e8e3525667da9