⚙️Race Condition
Also known as Data Race, Race Bug
A bug where the result depends on which task gets there first.
Think of it like
Think of it like two people writing on the same line of a board at once. The words get mixed up.
Example
Jack's shop has 1 item left. Two buyers click at the same moment, both checks see 1 in stock, and the item is sold twice.
Why it matters
Race bugs pass tests. Then they fail in real use, when many users act at the same moment.
Definition
Common mistake
Key takeaways
- 1Timing decides. Who gets there first.
- 2Shared data. Read, change, write.
- 3Rare, then costly. Hard to reproduce.