2 ms·
>But saying that you can debug multithreaded code with prints is just false Not every bug in multithreaded programming is a race condition bug, I'm not sure wh
by kgeist 4y ago
>But saying that you can debug multithreaded code with prints is just false
Not every bug in multithreaded programming is a race condition bug, I'm not sure why you are equating "debugging a multithreaded program" with "debugging a race condition". If your program consists of stateless shared-nothing workers which take an input and produce an output, most of the state operated on according to business rules is local to the worker and the current request, with no shared state (in memory at least). In my experience, with this kind of setup, most of the bugs are logic bugs and silly programming errors, not race conditions. The problem is that data can be passed from worker to worker between threads, processes, machines, and it's easier to debug it via logging. I'm not saying you should debug race conditions with print(), but a debugger with stepping won't help you either. It's a hard task in general - to debug race conditions, not sure why it's brought up. Printing/logging at least is useful as a first step to investigate what's going on at all.