race con·di·tion
/ˈreɪs kənˌdɪʃ.ən/ (RAYS kun-dish-un) noun
- A bug where the outcome depends on the unpredictable timing or ordering of concurrent operations. Two checkout requests both read 'one item in stock' and both succeed.
Origin
From digital-circuit design in the 1950s, where two signals 'race' to change an output.
In practice
Look for read-then-write sequences on shared state. Transactions, atomic operations and unique constraints close the gap.
Say to your AI
Find race conditions in this handler. Assume two requests for the same user arrive at once, and show the interleaving that breaks it.
In plain words
- the bug only happens sometimes
- two requests at the same time break it
- flaky timing bug
- works locally but fails randomly in production
See also lost update serializability idempotency