hn.today

Heisenbug

en.wikipedia.org3 points0 comments
Screenshot of Heisenbug

A heisenbug is a software defect whose behavior changes or disappears when someone tries to observe it, often by adding diagnostic output or running a debugger. These methods can alter memory layout, variable values, or execution timing, exposing or suppressing the underlying problem. Examples include code that fails only under compiler optimization, bugs involving uninitialized variables or invalid pointers, and race conditions that vanish when debugging slows a program. Even taking a screenshot can make a display glitch disappear when the image captures a different rendering path. The name invokes physicist Werner Heisenberg, though the analogy is technically imprecise: the uncertainty principle and the observer effect are distinct ideas, and electronics uses “probe effect” for the similar impact of measurement on a device.

The term dates to at least 1983 and appeared in a 1985 paper by Jim Gray, though it is sometimes mistakenly credited to him as its origin. Related slang distinguishes stable, reproducible “bohrbugs” from “mandelbugs,” whose complexity makes them seem chaotic; “schrödinbugs,” which appear when someone notices code should not work; catastrophic “hindenbugs”; and elusive, hard-to-reproduce “higgs-bugsons.” Heisenbugs are especially difficult to diagnose because attempts to fix or examine them can trigger more unexpected behavior, and the visible symptom may stem from a deeper defect. Their frequency is expected to decline as software matures. The playful terminology captures a practical debugging challenge: observation itself can change the conditions that produce a failure.

Read on en.wikipedia.org0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.