concurrency-race-condition-testing
Installation
SKILL.md
Concurrency & Race-Condition Testing
Races don't fail on demand. You must force interleavings and detect violations.
Bug catalog (what to hunt)
Lost update (read-modify-write) · double spend / oversell (check-then-act) · duplicate submit / retry storms · deadlock (lock ordering) · livelock/starvation · stale cache after write · non-atomic multi-step DB ops · async callbacks out of order · TOCTOU file/permission checks · unsafe shared state in singletons · connection/thread-pool exhaustion.
Detection tools
| Stack | Tool |
|---|---|
| Go | go test -race -count=100 ./... |
| C/C++/Rust | ThreadSanitizer (-fsanitize=thread), loom (Rust) |
| Java | jcstress, -XX:+..., Thread dumps, jstack deadlock detection |
| Python | pytest-xdist, threading.Barrier, asyncio.gather stress |
| JS/TS | Promise.all bursts, jest --runInBand vs parallel diff |
| DB | Two sessions + pg_sleep/SLEEP() to widen windows; isolation-level tests |
| System | stress-ng, k6/Locust with identical concurrent requests |