Heisenbug, or like the Moon spoils the code

the Moon is waning, it happens... ©Zemfira

Heisenbug called the kind of software glitches that occurs and do not understand how, defies debugging and detection. In short, behaves like the most Elusive Joe or krokovsky cat recent post. I work had to deal with such and I called it quantum mechanics until, until I found out that is close in meaning to the name has long been invented. Happens, send the customer a debug binary which just logs more events around the alleged source of the problem and then the problem disappears!

heisenbug /hi:'zen-don/ n.
A bug that disappears or alters its behavior when one attempts to probe or isolate it.



I offer you my small collection of cognitive quantum effects programming.


the

Episode I, OpenOffice does not print on Tuesday


the History of this remarkable bug report can be read on Ubuntu Launchpad, and I will briefly outline the essence for those who are not handy to read the link. In the system utility, file was a bug due to which the files containing the 4-m byte Tue is defined as Erlang JAM. The defect was present in versions of file 4.21 and 4.24 and was caused by a bug in magic file.


the
anon@x-X:~$ echo "1/2 Tue" >> file && file file
file: Jan 22 14:32:44 MET 1991\011Erlang JAM file - version 4.2
anon@x-X:~$ file --version
file-4.21
magic file from /etc/magic:/usr/share/file/magic

This led to the fact that on Tuesdays for banoi version of file timestamps PostScript files were similar to Erlang JAM.


the
%%CreationDate: (Tue Mar 3 19:47:42 2009)

When a job is submitted to series printers, Brother, OpenOffice can run the verification procedure a PostScript file, which failed, because I discovered the type of Erlang JAM file. The correction was mostly limited to the shielding of a space.


the
 +# 4.2 version may have a copyright notice!
-+4 string Tue Jan 22 14:32:44 MET 1991 Erlang JAM file - version 4.2
-+79 string Tue Jan 22 14:32:44 MET 1991 Erlang JAM file - version 4.2
++4 string Tue\ Jan\ 22\ 14:32:44\ MET\ 1991 Erlang JAM file - version 4.2
++79 string Tue\ Jan\ 22\ 14:32:44\ MET\ 1991 Erlang JAM file - version 4.2

However, with Barnim file the problem was eliminated simply, however, by the time the heisenbug has already turned 9 months old!


the
sed -e '/^%%CreationDate:/s/Tue/tue/' > $INPUT_TEMP

the

Episode II, the Moon and Perl


Once on the net I came across this the perfect instance of it humor. Languishing with boredom, the Debian developer decided to calculate the dependence of bug reports from the phases of the moon and quickly wrote this script.


Perl script
#!/usr/bin/perl -w

use strict;
use warnings;

use constant PI = > 3.1415926535;

use feature "say";

use SOAP::Lite;
use Astro::Coord::ECI::Moon;

my $soap = SOAP::Lite- > uri('Debbugs/SOAP')->proxy('http://bugs.debian.org/cgi-bin/soap.cgi');

if (!defined($ARGV[0])) {
die "E: you must have a source package!\n";
}

my @bugs = $soap- > get_bugs(src=>$ARGV[0])->result();

my $bugsdata = $soap->get_status(@bugs)->result();
my $moon = Astro::Coord::ECI::Moon- > new();
my %count = ( 'new' => 0, 'first' => 0, 'full' => 0, 'last' => 0);

foreach my $bug (keys %$bugsdata) {
my $time = $$bugsdata{$bug}- > {date};
my $phase = $moon- > phase($time);
if ($phase <= 45 * PI / 180 || $phase > 315 * PI / 180) {
$count{'new'} = $count{'new'} + 1;
} elsif ($phase <= 135 * PI / 180 && $phase > 45 * PI / 180) {
$count{'first'} = $count{'first'} + 1;
} elsif ($phase <= 225 * PI / 180 && $phase > 135 * PI / 180) {
$count{'full'} = $count{'full'} + 1;
} elsif ($phase <= 315 * PI / 180 && $phase > 225 * PI / 180) {
$count{'last'} = $count{'last'} + 1;
}
}

say "Number of bug submissions during new moon :" . $count{new};
say "Number of bug submissions during the first quarter:" . $count{first};
say "Number of bug submissions during full moon :" . $count{full};
say "Number of bug submissions during the last quarter :" . $count{last};

for package nbd has been encouraging, the dependence is clearly hatch.


the
wouter@carillon:~code/perl$ ./debbugsmoon nbd
Number of bug submissions during new moon : 2
Number of bug submissions during first quarter: 10
Number of bug submissions during full moon : 1
Number of bug submissions during last quarter : 3

For scientism can be, even in R to test the hypothesis of functional dependence. Data is not enough, but the figures are — p-value = 0.005853.


Chi-squared test for given probabilities data: c(2, 10, 1, 3) X-squared = 12.5, df = 3, p-value = 0.005853 Warning: In chisq.test(c(2, 10, 1, 3)) : approximation based on the Chi-square may be incorrect

I decided to repeat the experiment after 6 years, what do you think?


the
[5153:23311 0:604] 06:09:39 Sun Aug 28 [mikayel@redeye: +4] ~ 
(4:604)$ ./debbugsmoon.pl nbd
Number of bug submissions during new moon : 1
Number of bug submissions during first quarter: 12
Number of bug submissions during full moon : 3
Number of bug submissions during the last quarter : 1

With this nbd something is clearly wrong, lunar phases now push harder!


the
> chisq.test(c(1, 12, 3, 1))
Chi-squared test for given probabilities

data: c(1, 12, 3, 1)
X-squared = 19.471, df = 3, p-value = 0.0002185

Warning:
In chisq.test(c(1, 12, 3, 1)) :
approximation based on the Chi-square may be incorrect

Perhaps there are examples and brighter, if you check out all 43 thousand packages of Debian Linux, but it's not the best waste of time.


the

Episode III, Moon, and LISP


a Bad dancer is not always possible complicated steps, and programmers are occasionally shits the Moon. We know that thanks to the hackers of old schools, published in 1983. Hacker's Dictionary, which is also called the Jargon File. Since then the book has withstood several editions and became a kind of classic of the genre. In the article Phase of the Moon [1] there is a rather amusing tale on the topic.


One day, Guy Steele [2], while still a student at MIT, got a bug in your code MacLisp [3], recording timestamps in a separate file containing forms to include the standard function of calculating the phase of the moon. According to unconfirmed reports bainuu also wrote Gerry Sussman [4]. Occasionally the program was crash, and this happened every month at the same time due to the fact that the first entry rolled out a new line, not labeling the comment symbol ";". The length of the first recording dependent on a timestamp and a specific phase, that is, exceeded the breadth of the page in 80 characters depending on the lunar calendar!


In the same article mentioned another case, when CERN failed program of calculation of the result of the experiments at LEP Collider [5]. The long search for the causes of failures finally led to the solution. Ring the perimeter of the LEP, of 27 km in length, was very slightly deformed due to the gravity of the moon. This story became part of folklore among physicists, received the name of Newton's Retribution. For the accuracy of the details of the story cannot vouch, as the so-called tidal deformation known for decades as. I would like to know the opinion of Habr on this subject.


the

Episode IV, my Heisenbug


was absolutely insane bug which led to complete or partial freeze of the OS in listening to music through USB headphones, and often hang led listening to Internet radio. I suffered a couple of years and then, realizing that nothing has changed from the change of the versions of the Linux kernel, Xorg and drivers, sent a bug report in Gentoo Bugzilla.


This happens for already 4 years with kernels starting from 2.6.20 to 2.6.31. Similarly it happened on "HP nc 6220" no intel based chipset running "Debian Linux 5.x." again headphones were USB Plantronics DSP 300.
Surprisingly it never happens under a live CD, I tested few times keeping audio-streaming for 1 hour and nothing crashed.


Loosely translated, this is the complaint that the heisenbug for 4 years and he feels equally comfortable on the versions of Linux kernel 2.6.20 on 2.6.31, AMD Radeon Xpress 200M and inalaska 915GM, but for some reason did not catch on LiveCD distributions.


At the time of hang-up anywhere error messages does not arise and only in /var/log/messages has an entry: N URBs still active, where N is an even number of < 10. Most likely case occurred in a kernel module snd_usb_audio, carelessly processed, and brought the system to a screeching halt.




the Last entry in the bug report that I have changed the option for hardware acceleration for open graphics drivers radeon


the
Option "AccelMethod" "EXA" #was
Option "AccelMethod" "XAA" #

after that problem disappeared, but it is unclear how and why, because this change is in no way associated with the snd_usb_audio.




    the
  1. the Author is so marked a kind of Heisenbug. The link, the Jargon File, version 4.3.3.
  2. the
  3. Author of Common Lisp the Language, one of the founders of the language of programirovaniya Scheme.
  4. the
  5. Dialect of the Lisp programming language developed in the MIT artificial intelligence lab.
  6. the
  7. One of the creators of the programming language Scheme, a co-author of the book Structure and Interpretation of Computer Programs.
  8. the
  9. Large electron-positron Collider.
Article based on information from habrahabr.ru

Comments

Popular posts from this blog

Powershell and Cyrillic in the console (updated)

Active/Passive PostgreSQL Cluster, using Pacemaker, Corosync

Automatic deployment ElasticBeanstalk using Bitbucket Pipelines