What is the name of the kind of bug that resolves itself whenever you add a log line in the code that would finally cause you to understand it -- then comes back after you remove the log line?

Reply to this note

Please Login to reply.

Discussion

Mind bug.

Schrödinger’s bug

That's what I wanted to call it, but I just learned "heisenbug" is the canonical name.

The log-me-not bug?

This is a very problematic bug…

That's a feature

transitory

Bug of Schrödinger 🐞. And this exact same thing happened to me today!

race condition

I can’t think of a single time that a heisenbug was not due to a race condition.

My memory came back: note1u66xnz0yurdv6raa6kksyqeunkqe4v49mawz4nr56yylc7xj4r4sk4zm9z

A bad motherfucker 🐞

Heisenbug?

Yes! Came here to say the same 😄

My daughter said Cats in the Cradle bug. Ls.

Heisenbug

-O3

Murphy’s bug?

a shy bug

Heisenbug

Quantum bug

Race condition.

Caused by the log line actually waiting on a lock on a common shared resource like the stdout stream. Thus acting like a kind of micro sleep.

Related article for nodejs folks: https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick#processnexttick-vs-setimmediate

In that case replacing the log line with an actual sleep should also work, right? How long? I tries sleeping for 1ms but the bug returned.

are you working in Go? if so you can pass the -race flag go test/build/run to invoke the race detector

Not necessarily. Does the log write direct or is there flushing, batched kernel io, etc? (Just pulling shit out of thin air without knowing context)

That is to say; *any* work can affect a race condition outcome. But that work may not be happening where you think it is, for all sorts of reasons.

Hard to make suggestions with no context but generated code and strace are good tools. Tricky if working within many layers of abstraction.

Meant to type *”comparing generated code”

Thank you. Yes, there are many layers.

Which platform? Nodejs, Deno, Bun, Lambda?

Another possibility is that it is not a race condition and that the log is causing a memory allocation which in turn changes the location of subsequent allocations.

I.e. it could be a memory safety issue; use after free, buffer overrun, etc. ASan can be helpful in this scenario.

Could also be classified as a Heisenbug that has the side-effect of resolving a non-deterministic race condition.

https://en.m.wikipedia.org/wiki/Heisenbug

A Relationship?

Depends, if it comes back after you remove the log line, then it is a quantum bug

Joe Biden Bug

Very annoying one...

Heisenberg

Heisenbug

Ah yes

A rat bastard

concurrency, mate disk latency is our friend!

Attention.

Perhaps the log is adding to the stack and line in question is now tweaking different stack values? Post the function?

A bugger

#NotUnitTested

?

Perhaps you just need sleep, have a walk in the park and return to the issue later.

One could call a heisenbug, but being more precise, it's probably some sort of race condition.

Those are called "You little piece of shit, why do you do this to me, I should be a barista instead!" bugs.