Heisenbug is a whimsical computer programming jargon term for a software bug (glitch) that seems to disappear or alter its behavior when one attempts to study it.
The term is a pun on the name of Werner Heisenberg, the physicist who first asserted the observer effect of quantum mechanics, which states that the act of observing a system inevitably alters its state.
Heisenbugs occur because common attempts to debug a program, such as running it in a debugger, usually modify the code. In general, programs that exhibit time-dependent behavior are vulnerable to time-dependent failures. These could occur during a certain part of a scheduled process, or at special times, such as on leap days or when a process crosses a daylight saving time, day, month, year, or century boundary (as with the Year 2000 problem). Frustrated programmers may humorously blame a heisenbug on the phase of the moon, or (if it has occurred only once) may explain it away as a soft error due to alpha particles or cosmic rays affecting the hardware.
A ‘bohrbug,’ by opposition, is a ‘good, solid bug.’ Like the deterministic Bohr atom model, they don’t change their behavior and are relatively easily detected. A ‘mandelbug’ (named after Benoît Mandelbrot’s fractal) is a bug whose causes are so complex it defies repair, or makes its behavior appear chaotic or even non-deterministic (continually changing direction). A ‘schrödinbug’ (named after Erwin Schrödinger and his thought experiment) is a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place. The term was used in 1985 by Jim Gray, in a paper about software failures (and is sometimes mistakenly attributed to him because of this publication).


