HOME

TheInfoList



OR:

In
computer programming Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as ana ...
jargon, a heisenbug is a
software bug A software bug is an error, flaw or fault in the design, development, or operation of computer software that causes it to produce an incorrect or unexpected result, or to behave in unintended ways. The process of finding and correcting bugs i ...
that seems to disappear or alter its behavior when one attempts to study it. The term is a
pun A pun, also known as paronomasia, is a form of word play that exploits multiple meanings of a term, or of similar-sounding words, for an intended humorous or rhetorical effect. These ambiguities can arise from the intentional use of homophoni ...
on the name of
Werner Heisenberg Werner Karl Heisenberg () (5 December 1901 – 1 February 1976) was a German theoretical physicist and one of the main pioneers of the theory of quantum mechanics. He published his work in 1925 in a breakthrough paper. In the subsequent series ...
, the
physicist A physicist is a scientist who specializes in the field of physics, which encompasses the interactions of matter and energy at all length and time scales in the physical universe. Physicists generally are interested in the root or ultimate caus ...
who first asserted the
observer effect Observer effect, observer bias, observation bias, etc. may refer to a number of concepts, some of them closely related: General experimental biases * Hawthorne effect, a form of reactivity in which subjects modify an aspect of their behavior, in ...
of
quantum mechanics Quantum mechanics is a fundamental theory in physics that provides a description of the physical properties of nature at the scale of atoms and subatomic particles. It is the foundation of all quantum physics including quantum chemistry, ...
, which states that the act of observing a system inevitably alters its state. In electronics, the traditional term is
probe effect Probe effect is an unintended alteration in system behavior caused by measuring that system. In code profiling and performance measurements, the delays introduced by insertion or removal of code instrumentation may result in a non-functioning appl ...
, where attaching a
test probe A test probe is a physical device used to connect electronic test equipment to a device under test (DUT). Test probes range from very simple, robust devices to complex probes that are sophisticated, expensive, and fragile. Specific types include t ...
to a device changes its behavior. Similar terms, such as ''bohrbug'', ''mandelbug'', ''hindenbug'', and ''schrödinbug'' (see the section on
related terms ''Related'' is an American comedy-drama television series that aired on The WB from October 5, 2005, to March 20, 2006. It revolves around the lives of four close-knit sisters of Italians, Italian descent, raised in Brooklyn and living in Manhat ...
) have been occasionally proposed for other kinds of unusual software bugs, sometimes in jest.


Examples

Heisenbugs occur because common attempts to debug a
program Program, programme, programmer, or programming may refer to: Business and management * Program management, the process of managing several related projects * Time management * Program, a part of planning Arts and entertainment Audio * Progra ...
, such as inserting output statements or
running Running is a method of terrestrial locomotion allowing humans and other animals to move rapidly on foot. Running is a type of gait characterized by an aerial phase in which all feet are above the ground (though there are exceptions). This is ...
it with a
debugger A debugger or debugging tool is a computer program used to software testing, test and debugging, debug other programs (the "target" program). The main use of a debugger is to run the target program under controlled conditions that permit the pr ...
, usually have the side-effect of altering the behavior of the program in subtle ways, such as changing the
memory address In computing, a memory address is a reference to a specific memory location used at various levels by software and hardware. Memory addresses are fixed-length sequences of digits conventionally displayed and manipulated as unsigned integers. Su ...
es of variables and the timing of its execution. One common example of a heisenbug is a bug that appears when the program is compiled with an optimizing
compiler In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs that ...
, but not when the same program is compiled without optimization (as is often done for the purpose of examining it with a debugger). While debugging, values that an optimized program would normally keep in registers are often pushed to main memory. This may affect, for instance, the result of
floating-point In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can b ...
comparisons, since the value in memory may have smaller range and accuracy than the value in the register. Similarly, heisenbugs may be caused by side-effects in test expressions used in runtime assertions in languages such as C and
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
, where the test expression is not evaluated when assertions are turned off in production code using the NDEBUG macro. Other common causes of heisenbugs are using the value of a non-initialized variable (which may change its address or initial value during debugging), or following an
invalid Invalid may refer to: * Patient, a sick person * one who is confined to home or bed because of illness, disability or injury (sometimes considered a politically incorrect term) * .invalid, a top-level Internet domain not intended for real use As t ...
pointer (which may point to a different place when debugging). Debuggers also commonly allow the use of
breakpoint In software development, a breakpoint is an intentional stopping or pausing place in a program, put in place for debugging purposes. It is also sometimes simply referred to as a pause. More generally, a breakpoint is a means of acquiring knowle ...
s or provide other user interfaces that cause additional
source code In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the wo ...
(such as property accessors) to be executed stealthily, which can, in turn, change the state of the program. Time can also be a factor in heisenbugs, particularly with multi-threaded applications. Executing a program under control of a debugger can change the execution timing of the program as compared to normal execution. Time-sensitive bugs, such as
race condition A race condition or race hazard is the condition of an electronics, software, or other system where the system's substantive behavior is dependent on the sequence or timing of other uncontrollable events. It becomes a bug when one or more of t ...
s, may not occur when the program is slowed down by single-stepping source lines in the debugger. This is particularly true when the behavior involves interaction with an entity not under the control of a debugger, such as when debugging network packet processing between two machines and only one is under debugger control. Heisenbugs can be viewed as instances of the observer effect in information technology. Frustrated programmers may humorously blame a heisenbug on the
phase of the moon Concerning the lunar month of ~29.53 days as viewed from Earth, the lunar phase or Moon phase is the shape of the Moon's directly sunlit portion, which can be expressed quantitatively using areas or angles, or described qualitatively using the t ...
, or (if it has occurred only once) may explain it away as a
soft error In electronics and computing, a soft error is a type of error where a signal or datum is wrong. Errors may be caused by a defect, usually understood either to be a mistake in design or construction, or a broken component. A soft error is also a s ...
due to
alpha particle Alpha particles, also called alpha rays or alpha radiation, consist of two protons and two neutrons bound together into a particle identical to a helium-4 nucleus. They are generally produced in the process of alpha decay, but may also be produce ...
s or
cosmic ray Cosmic rays are high-energy particles or clusters of particles (primarily represented by protons or atomic nuclei) that move through space at nearly the speed of light. They originate from the Sun, from outside of the Solar System in our own ...
s affecting the hardware, a well-documented phenomenon known as single event effects.


Related terms

A ''bohrbug'', by way of contrast, is a "good, solid bug". Like the deterministic
Bohr atom model In atomic physics, the Bohr model or Rutherford–Bohr model, presented by Niels Bohr and Ernest Rutherford in 1913, is a system consisting of a small, dense nucleus surrounded by orbiting electrons—similar to the structure of the Solar Syste ...
, they do not change their behavior and are relatively easily detected. A ''mandelbug'' (named after
Benoît Mandelbrot Benoit B. Mandelbrot (20 November 1924 – 14 October 2010) was a Polish-born French-American mathematician and polymath with broad interests in the practical sciences, especially regarding what he labeled as "the art of roughness" of phy ...
's
fractal In mathematics, a fractal is a geometric shape containing detailed structure at arbitrarily small scales, usually having a fractal dimension strictly exceeding the topological dimension. Many fractals appear similar at various scales, as illu ...
) is a bug whose causes are so complex it defies repair, or makes its behavior appear
chaotic Chaotic was originally a Danish trading card game. It expanded to an online game in America which then became a television program based on the game. The program was able to be seen on 4Kids TV (Fox affiliates, nationwide), Jetix, The CW4Kid ...
or even non-deterministic. The term also refers to a bug that exhibits fractal behavior (that is,
self-similarity __NOTOC__ In mathematics, a self-similar object is exactly or approximately similar to a part of itself (i.e., the whole has the same shape as one or more of the parts). Many objects in the real world, such as coastlines, are statistically se ...
) by revealing more bugs (the deeper a developer goes into the code to fix it the more bugs they find). A ''schrödinbug'' or ''schroedinbug'' (named after
Erwin Schrödinger Erwin Rudolf Josef Alexander Schrödinger (, ; ; 12 August 1887 – 4 January 1961), sometimes written as or , was a Nobel Prize-winning Austrian physicist with Irish citizenship who developed a number of fundamental results in quantum theory ...
and his
thought experiment A thought experiment is a hypothetical situation in which a hypothesis, theory, or principle is laid out for the purpose of thinking through its consequences. History The ancient Greek ''deiknymi'' (), or thought experiment, "was the most anci ...
) is a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place. A ''hindenbug'' (named after the
Hindenburg disaster The ''Hindenburg'' disaster was an airship accident that occurred on May 6, 1937, in Manchester Township, New Jersey, United States. The German passenger airship LZ 129 ''Hindenburg'' caught fire and was destroyed during its attemp ...
) is a bug with catastrophic behavior. A ''higgs-bugson'' (named after the
Higgs boson The Higgs boson, sometimes called the Higgs particle, is an elementary particle in the Standard Model of particle physics produced by the quantum excitation of the Higgs field, one of the fields in particle physics theory. In the Stand ...
particle) is a bug that is predicted to exist based upon other observed conditions (most commonly, vaguely related log entries and anecdotal user reports) but is difficult, if not impossible, to artificially reproduce in a development or test environment. The term may also refer to a bug that is obvious in the code (mathematically proven), but which cannot be seen in execution (yet difficult or impossible to actually find in existence).


Etymology

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) and also in 1986 by Jonathan Clark and Zhahai Stewart on the mailing list (later
Usenet Usenet () is a worldwide distributed discussion system available on computers. It was developed from the general-purpose Unix-to-Unix Copy (UUCP) dial-up network architecture. Tom Truscott and Jim Ellis conceived the idea in 1979, and it was ...
news group) comp.risks.(16 December 1986
RISKS DIGEST 4.30
- (23 December 1986
RISKS DIGEST 4.34
moderated by
Peter G. Neumann Peter Gabriel Neumann (born 1932) is a computer-science researcher who worked on the Multics operating system in the 1960s. He edits the RISKS Digest columns for ACM ''Software Engineering Notes'' and ''Communications of the ACM''. He founded ...
Bruce Lindsay, a researcher at IBM, affirmed in a 2004
ACM Queue ''ACM Queue'' is a bimonthly computer magazine founded and published by the Association for Computing Machinery The Association for Computing Machinery (ACM) is a US-based international learned society for computing. It was founded in 1947 an ...
interview that he was present when the Heisenbug was originally defined. An earlier appearance in ACM publications is from 1983.


Resolution

Heisenbugs are difficult to identify and fix; often attempting to resolve them leads to further unexpected behavior. Because the problem manifests as the result of a separate, underpinning bug, the behavior can be hard to predict and analyze during debugging. Overall the number of heisenbugs identified should decrease as a piece of software matures.


See also

*
Cargo cult programming Cargo cult programming is a style of computer programming characterized by the ritual inclusion of code or program structures that serve no real purpose. Cargo cult programming is symptomatic of a programmer not understanding either a bug they were ...
*
Memory debugger Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembered, ...
*
Jinx Debugger Jinx was a concurrency debugger that deterministically controlled the interleaving of workloads across processor cores, focusing on shared memory interactions. Using this deterministic approach, Jinx aimed to increase the frequency of occurrence ...
—a tool that automatically explores executions likely to expose Heisenbugs


References


External links


The Heisenberg Debugging Technology



OpenOffice won't print on Tuesdays
a fascinating heisenbug it took almost nine months to solve. {{DEFAULTSORT:Unusual Software Bug Software bugs Debugging Software testing Computer programming folklore Software engineering folklore