Implement race-resistant stale lock detection

Add failing test for staleness contention
Fix #4