Overview
- Bug Type:
- Race condition
- Category:
- Concurrency, Async & Events
Definition
Concurrent operations interleave on shared state without proper synchronization, making outcomes timing-dependent.
How to fix Race condition?
Use locks/CAS/transactions; isolate state; design idempotent operations; add stress tests and deterministic synchronization
Symptoms
Observable signs that may indicate Race condition:
- Non-deterministic failures under load or on CI.
- Data occasionally overwritten or lost when requests overlap.
- Flaky tests that pass locally but fail intermittently.
Example Errors:
- ConcurrentModificationException
- Optimistic locking failure / ETag precondition failed
- Write conflict detected
