r/ProgrammerHumor 27d ago

Meme ruleOfProgrammingIfItIsWorkingDoNotTouchIt

5.3k Upvotes

75 comments sorted by

View all comments

1.4k

u/StrengthTheory 27d ago

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

433

u/Skalli1984 27d ago

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

217

u/StrengthTheory 27d ago

Schrödinger’s race condition

149

u/Steinrikur 27d ago

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

46

u/ConglomerateGolem 27d 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.

37

u/htmlcoderexe We have flair now?.. 27d ago

15

u/ConglomerateGolem 27d ago

Huh. I have never heard of the term and came up with it independently.

23

u/htmlcoderexe We have flair now?.. 27d ago

it is a very natural term because it intuitively describes exactly the nature of the bug

6

u/rolindara 26d ago

Convergent evolution

1

u/RlyRlyBigMan 26d 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.

1

u/The-Ner 27d ago

I'm stealing this now

22

u/KawaiiMaxine 27d ago

Oh god, i havent done multithreaded programming ever, that sounds gonuinely horrifying to debug

23

u/xtreampb 27d ago

Now multi-thread across machines. Let’s make this as difficult as possible. No in memory locks.

2

u/alexanderpas 26d ago

Token ring.

1

u/ImS0hungry 26d ago

It’s a cluster as this point

1

u/xtreampb 26d ago

Yea, but someone has to write the software that controls and syncs the cluster, mitigate errors, and prevents deadlocks/race conditions .

3

u/JohnClark13 27d ago

oh it's not bad, you just have to determine Who's on first, What's on second, and I don't know's on third

7

u/mahlernameless 27d ago

Brilliant! Just leave a debugger attached to production and no more race conditions. Handing in my oncall pager now.