Heisenbug

from Wikipedia, the free encyclopedia

In computer programming jargon, a Heisenbug is a software bug that appears to go away or change its behavior when you try to investigate it. The term is a play on words with the name Werner Heisenberg , the physicist who was the first to assert the observer effect of quantum mechanics , which states that the act of observing a system inevitably changes its state. In electronics , the traditional term is the probe effect, where attaching a test probe to a device changes its behavior.

Similar terms such as Bohrbug , Mandelbug , Hindenbug, and Schrödinbug (see the section on related terms) have occasionally been suggested for other types of unusual software bugs, sometimes in jest; unlike the term Heisenbug, however, they are not generally known or used.

Examples

Heisenbugs usually occur with programming errors that are influenced by examining / debugging a computer program , such as B. the insertion of input and output statements or the execution (calculation) with a debugger , whereby as a side effect the behavior of the program is changed in subtle ways, e.g. B. changing the memory address of variables and the time of execution.

A common example of a Heisenbug is a programming bug that results in a runtime error when the program is compiled with an optimizing compiler , but not when the same program is compiled without optimization (as is often done for the purpose of investigation with a debugger) . During debugging, values ​​that an optimized program would normally keep in registers are often pushed into main memory. This can e.g. B. affect the result of a floating point calculation , since the value in the memory can have a smaller range and less accuracy than the value in the register. In a similar way, Heisenbugs can disappear due to side effects in test expressions: The error does not occur during development because the assertions are executed in languages ​​such as C and C ++ at runtime ; however, the test printout is no longer evaluated if NDEBUGthe assertions are switched off in the production code with the macro - now the error occurs.

Other common causes of Heisenbugs are programming errors such as using the value of an uninitialized variable (which can change its address and / or its initial value during debugging) or following an invalid pointer (which can refer to another location while debugging). Debuggers generally also allow the use of breakpoints or provide other user interfaces that cause additional source code (such as property accessors) to be executed covertly, which can hide timing-related errors.

Related terms

A drilling bug , on the other hand, is a "good, solid bug". Like Bohr's deterministic atomic model , they do not change their behavior and are relatively easy to discover.

A Mandelbug (named after the " Mandelbrot set " by Benoît Mandelbrot ) is an error whose causes are so complex that it cannot be repaired or its behavior appears to be chaotic or even a nondeterministic system. The term also refers to a bug that exhibits fractal behavior (i.e., self-similarity ) by exposing more bugs (the deeper a developer goes into the code to fix it, the more bugs he finds).

A Schrödingbug (named after Erwin Schrödinger and his thought experiment ) is a bug that manifests itself in running software after a programmer realizes that the code should not have worked in the first place.

A hindenbug (named after the Hindenburg disaster ) is a bug with catastrophic behavior.

A Higgs-Bugson (named for the Higgs boson particle) is a bug that is predicted to exist based on other observed conditions (most commonly, vaguely related log entries and anecdotal user reports) but is severe, if not severe, in a development or test environment impossible to reproduce artificially. The term can also refer to a bug that is evident (mathematically proven) in the code, but cannot be seen in execution (and the actual existence of which is difficult or impossible to find).

Individual evidence

  1. heisenbug. Retrieved April 17, 2020 .