Concurrency - Race Condition
1 - About
Race conditions have a reputation of being difficult to reproduce and debug, since the end result is nondeterministic and depends on the relative timing between interfering threads.
Problems occurring in production systems can therefore disappear when running in debug mode, when additional logging is added, or when attaching a debugger, often referred to as a “Heisenbug”. It is therefore better to avoid race conditions by careful software design rather than attempting to fix them afterwards.
If two threads run simultaneously without locking or synchronization, the outcome of the operation could be wrong.