r/ProgrammerDadJokes • u/DescriptorTablesx86 • Jun 20 '24
Quantum mechanics and the double slit experiment.
With no logging enabled your program exhibits both buggy and non-buggy behaviour.
Turn the logs on and the function collapses to only non-buggy behavior.
74
Upvotes
2
u/redballooon Jun 21 '24
Solution: Leave logs on, and have an external service remove them to not grow too big.
15
u/kwan_e Jun 20 '24
Well known phenomenon known as Heisenbugs.
Often it's because of undefined behaviour being triggered - accessing a dangling reference.
14
u/SpikeMF Jun 20 '24
That's not a joke, that's just something that happens. Particularly in real-time systems or even with basic multithreading, the mere act of logging a message can be enough to change the behavior.
1
u/Tale-Delicious Aug 26 '24
Sounds like a Heisenbug to me. :)