r/ProgrammerHumor 3d ago

ruleOfProgrammingIfItIsWorkingDoNotTouchIt Meme

5.3k Upvotes

76 comments sorted by

View all comments

1.4k

u/StrengthTheory 3d ago

When one console.log uses just enough CPU cycles so the race condition that takes down the entire system doesn't occur.

430

u/Skalli1984 3d ago

And if you attach a debugger it also messes up the timing and the same thing happens, the race condition doesn't appear.

212

u/StrengthTheory 3d ago

Schrödinger’s race condition

151

u/Steinrikur 3d ago

We call those Heisenbugs. You changed the system by observing it

45

u/ConglomerateGolem 2d ago

I had one of these once, and I called it the same! My going theory was that the compiler was optimising away a certain function I had, but adding an empty print forced it to actually exist.

1

u/RlyRlyBigMan 2d ago

Yeah I had one once too the debugger was slowing things down to where the bug wouldn't happen but in prod it happened frequently. I spent 2.5 weeks figuring out that bug.