|
|
|
|
|
by grishka
1814 days ago
|
|
As someone who wrote and debugged a lot of concurrent code, here's another advice: log everything. Log as much as you could in the part where you think the bug is. Log every line that's run if you have to. You'll then skim through the log file looking for any unexpected patterns. This approach works better than using a debugger, even on a single-core system, because these kinds of bugs tend to be hard to reproduce and take many iterations. You don't want it to hit a breakpoint a zillion times before it finally shows itself. And another one, tangential to what you said. Read your code line by line and ask yourself "what would break if a context switch happens right here" for each line. |
|
But for complex projects, reading code or relying on instincts may not work alone as brain power run out of capacity. That's why logging helps a lot