wordfor

hei·sen·bug

/ˈhaɪ.zən.bʌɡ/ (HY-zun-bug) noun jocular

Programmer folklore

  1. A bug that disappears or changes when you try to observe it, for example by adding logging or running a debugger. Adding a print statement changed the timing and hid the race: a classic heisenbug.

Origin

A pun on Werner Heisenberg's uncertainty principle. In print since the mid-1980s.

In practice

Heisenbugs usually point to timing, uninitialised memory or environment differences. Record more, change less: traces and core dumps disturb less than breakpoints.

Say to your AI

This bug disappears when I add logging. List the timing and concurrency explanations that fit that symptom, most likely first.

In plain words

  • the bug goes away when I add logging
  • it only happens in production
  • can't reproduce it in the debugger
  • it stops crashing when I watch it
  • the bug disappears when I attach a debugger

See also race condition works on my machine shotgun debugging

Find similar words