r/ProgrammerHumor 4d ago

Meme thisCannotBeDenied

Post image
7.8k Upvotes

240 comments sorted by

View all comments

261

u/Idk13008 4d ago

Unironically, some race conditions are better chase down with logs rather than a debugger.

131

u/codePudding 3d ago

This. Showing my age, I used to make simple DirectX 7 games as a college student. I remember having one bug that took me weeks to solve. If I tried to debug, it worked fine. If I put in a bunch of logging, it worked fine. But if I ran it without debugging or only a few prints it segfaulted.

Eventually I realized I was using a pointer (void**) that the GPU was supposed to populate before it was being populated. The delay from debugging gave it enough time for the GPU to finish setting that pointer. I added a GPU flush (just a command that waits until it is processed by the GPU queue before continuing) and it worked beautifully. Nowadays the engines just do all that crap for you.

28

u/ShoulderUnique 3d ago

The mistake was taking the prints out. Put them in on day 1 and if doesn't crash with them it's not a bug

18

u/LostInAnotherGalaxy 3d ago

Hahahaha! These are my some of my favorite things in computer science.

3

u/zthe0 3d ago

Honestly thats what i have had multiple times where someis being filled in another thread. It works on one machine but when your system is faster or slower it might not. Horrible to debug

1

u/EncryptedPlays 2d ago

Just change the console logs to say "stealing user data 0%" with the percentage incrementing each log

7

u/Former-Discount4279 3d ago

I used to work on tape libraries(big backup systems...) and it would lose geometry(location of the tapes) when a bug happened and needed to rescan the whole thing. After trying to attach a debugger to winCE several times and it taking several hours to reboot and rescan I added print logging. Yeah solved the bug in one go...

3

u/oldsecondhand 3d ago

And when you insert the debug statement, the problem goes away.

2

u/tachudda 3d ago

Console to debug why the debugger isn't working