worst bugs ever (or your most hated)

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
psykx
Posts: 408
Joined: Sat Feb 23, 2008 11:24 pm UTC
Location: England
Contact:

worst bugs ever (or your most hated)

Postby psykx » Sat Mar 08, 2008 6:19 pm UTC

I had a bug which I fixed today it took me about 8 hours to find the error in 6 lines of PHP code the reason?, I hear you ask, no I am not retarded the lines were the _same_. The only difference was the name of the template file. cp.html worked wcp.html doesn't work. I didn't make a mistake and name them something different and changing the name deleted my error because I checked.

I don't have enough energy to be angry about it anymore, would sure feel better if someone can tell me what happened or at least show me some of their evil bugs.
Last edited by psykx on Mon Mar 10, 2008 11:33 pm UTC, edited 1 time in total.
Berengal wrote:Only if they're killer robots. Legos are happy robots. Besides, even if they were killer robots it wouldn't stop me. You can't stop science and all that.

coppro
Posts: 117
Joined: Mon Feb 04, 2008 6:04 am UTC

Re: worst bugs ever (or you most hated)

Postby coppro » Sat Mar 08, 2008 6:29 pm UTC

I have encountered, whilst using old copies of MSVC, times when the code fails to compile for no reason whatsoever! The solution is to copy the entire file, delete it, make it again, and paste the exact same contents in the new file.

This is more irritating than anything I have ever encountered anywhere else (although a mistyped < or > is irritating)

Robin S
Posts: 3579
Joined: Wed Jun 27, 2007 7:02 pm UTC
Location: London, UK
Contact:

Re: worst bugs ever (or you most hated)

Postby Robin S » Sat Mar 08, 2008 6:33 pm UTC

Not annoying as such, but when writing a fractal generator I had one bug which made strange patterns appear in addition to the fractal itself. Example (the interior is meant to be black). These patterns can also be seen in my old avatar, which I may put back at some point, seeing as my current one was really intended for the festive season.
This is a placeholder until I think of something more creative to put here.

Paiev
Posts: 51
Joined: Sat Nov 17, 2007 11:17 pm UTC

Re: worst bugs ever (or you most hated)

Postby Paiev » Sat Mar 08, 2008 8:51 pm UTC

One that immediately springs to mind is a Windows program I was writing a while ago. For some reason, a few bitmaps weren't appearing properly. The debugger told me that the function calls that loaded the bitmaps were failing. I spent hours going over the code that loaded bitmaps before realizing, like a bolt from the blue, that I was modified a resource.h file in a different directory, and that I had added the bitmaps to a resource.h file that wasn't being included. When I found the bug, my feelings were mixed between joy and the desire to punch myself.

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: worst bugs ever (or you most hated)

Postby Berengal » Sat Mar 08, 2008 9:13 pm UTC

Paiev wrote:When I found the bug, my feelings were mixed between joy and the desire to punch myself.

Most of my debugging sessions end this way.

Most of them start with me shouting something along the lines of "Why doesn't this work?! It worked yesterday! I just loaded it! The unittests were fine yesterday, but today they fail! And this piece of code, which is IDENTICAL to the unittest, fails completely differently! How come this function causes an infinite loop, when there's not even a single loop or method call in it?! GAUH! If this is how you're going to behave, computer, then I'm going to study arts instead!"

Worst recent bug:
Method producing side-effects produced wrong side-effects in certain cases. Rewrite. Method now works for those cases, but not for other cases. Solution? The first algorithm... Find a third algorithm. Rewrite again. Method now works for both types of cases, but a third type of cases pop up, in which the third algorithm doesn't work. Solution? The two first algorithms... Put the buggy code in seven consecrated folders, encrypt it with nine sacred algorithms and store the keys in /dev/null. Rewrite whole module.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

Rysto
Posts: 1460
Joined: Wed Mar 21, 2007 4:07 am UTC

Re: worst bugs ever (or you most hated)

Postby Rysto » Sat Mar 08, 2008 9:15 pm UTC

Never, ever do a cp my_new_libc.so /lib/libc.so. Especially if my_new_libc.so is on an NFS mount. It took me hours to recover the system.

Grumpy Code Monkey
Posts: 99
Joined: Tue Feb 19, 2008 4:10 pm UTC
Location: Blue Texas

Re: worst bugs ever (or you most hated)

Postby Grumpy Code Monkey » Sun Mar 09, 2008 3:24 am UTC

My all-time favorite bug:

We were working on an output management system. New jobs would show up in a "pending" table in the database, and we would query the table every few seconds for new jobs. If any job entries were found, the transaction would be committed, and we'd process the jobs. The bug was that if the SELECT returned no rows, the transaction would not be committed. For this iteration of the software, we were using Jet as the database backend.

If not jobs were submitted for a long enough time (say, overnight), the transaction log would eventually fill up all available disk space until it crashed the system. That's right boys and girls, our product could bring your system down by not doing anything.

jople142
Posts: 1
Joined: Sun Mar 09, 2008 6:50 am UTC

Re: worst bugs ever (or you most hated)

Postby jople142 » Sun Mar 09, 2008 6:53 am UTC

So back when I first started learning Java I used Jcreator as an IDE. Everytime I wanted or needed to change a files name I would have trouble because If i changed the name outside Jcreator, Jcreator would give me problems. If I changed the name inside of Jcreator, the was a glitch? where is would not recognize the change is it was made in properties and I ended up needing to copy the entire file, make a file with the name a want it, and paste it agian. After doing so I would have no trouble compiling the file.

User avatar
'; DROP DATABASE;--
Posts: 3284
Joined: Thu Nov 22, 2007 9:38 am UTC
Location: Midwest Alberta, where it's STILL snowy
Contact:

Re: worst bugs ever (or you most hated)

Postby '; DROP DATABASE;-- » Sun Mar 09, 2008 7:16 am UTC

Any memory corruption. Those are always insane. fopen() will fail or malloc() will return the same pointer twice because some completely unrelated function in some other file isn't accounting for the NULL at the end of a buffer.

Also, here's a fun one that's annoying me right now (IPC is of type TransferRegion, but that's not really important):
printf("%08X, %u, %08X", IPC, sizeof(TransferRegion), IPC + sizeof(TransferRegion));
> 027FF000 60 027FFE10

Somehow any time I add sizeof(foo) to a pointer the result is way more than it should be. 60 times more in this case.
poxic wrote:You suck. And simultaneously rock. I think you've invented a new state of being.

User avatar
phlip
Restorer of Worlds
Posts: 7573
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: worst bugs ever (or you most hated)

Postby phlip » Sun Mar 09, 2008 7:22 am UTC

'; DROP DATABASE;-- wrote:Somehow any time I add sizeof(foo) to a pointer the result is way more than it should be. 60 times more in this case.

When you add an int to a pointer, it advances by multiples of the size of the thing pointed to.

So, since sizeof(*IPC) is 60, IPC + n will point n*60 bytes further ahead in memory than IPC does.

It's what makes the p[n] == *(p+n) equivalence work.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
'; DROP DATABASE;--
Posts: 3284
Joined: Thu Nov 22, 2007 9:38 am UTC
Location: Midwest Alberta, where it's STILL snowy
Contact:

Re: worst bugs ever (or you most hated)

Postby '; DROP DATABASE;-- » Sun Mar 09, 2008 7:29 am UTC

I thought it was something dumb like that. Only thing is it worked with an older version of the library. IPC must be some crazy macro or something that got changed...
Last edited by '; DROP DATABASE;-- on Mon Mar 10, 2008 10:40 pm UTC, edited 1 time in total.
poxic wrote:You suck. And simultaneously rock. I think you've invented a new state of being.

User avatar
Benny the Bear
Posts: 146
Joined: Sat Oct 27, 2007 2:44 am UTC
Location: Melbourne, Australia
Contact:

Re: worst bugs ever (or you most hated)

Postby Benny the Bear » Sun Mar 09, 2008 9:13 am UTC

Today I made a small console app that would convert chars to ints and visa versa. It could even convert a string of characters (no points for guessing the type) to an array of integers.

Anyway, I found a strange 'bug.' If I ever tried to enter 7 to be converted to a character, my computer would emit a 'beep!' and I would get no output.

If you want to see this yourself without my program, open command prompt an enter:

'echo' followed by a space. And then, after that space, hold down control+G. It should enter a character resembling '^G.' *Do not just type '^G.'*

Press enter, and voila.

The 'bug' was 'fixed' after reading a wiki article regarding ASCII.

Other integers that returned weird output include 7, 8, 13 and 19. Although I know what they do now, it was amusing at the time :) .

masher
Posts: 821
Joined: Tue Oct 23, 2007 11:07 pm UTC
Location: Melbourne, Australia

Re: worst bugs ever (or you most hated)

Postby masher » Sun Mar 09, 2008 10:00 am UTC

The first bug that I can remember writing was in uni.

We were playing with random number generators, and one of the assignments was to create a histogram showing their frequency distribution. Mine didn't work. I'd get a single entry with a value of one, and the remainder were all zero.

I printed everything to screen, yes, they are being generated correctly. I did some more stuff. Then I saw that the last number corresponded to the "1" on my histogram.

When I was looping back around to generate my 10e6 or so numbers, I was resetting my histogram values.

.

I wouldn't say that it's a "worst bug ever", but it's the first one that I can remember.

coppro
Posts: 117
Joined: Mon Feb 04, 2008 6:04 am UTC

Re: worst bugs ever (or you most hated)

Postby coppro » Sun Mar 09, 2008 2:50 pm UTC

'; DROP DATABASE;-- wrote:I thought it was something dumb like that. Only thing is it worked with an older version of the library. IPC must be some crazy macri or something that got changed...
Perhaps a TransferRegion was just a char back then, so sizeof(char) returned 1, making it give that behavior?

User avatar
The Hyphenator
Posts: 791
Joined: Mon Nov 19, 2007 2:16 am UTC
Location: The Shades, Ankh-Morpork

Re: worst bugs ever (or you most hated)

Postby The Hyphenator » Sun Mar 09, 2008 3:15 pm UTC

Switch/case ftw. I've used dozens of switch/case statements, and I still always forget the goddamn breaks. ALWAYS.

Oh, and fstream is the worst, most annoying library ever. Pretty much every time I've worked with it, something goes wrong (on it's part, not mine), and I have to find a workaround or just give up. I try to minimize file i/o in all of my programs so I won't get screwed over by fstream.
The image link changes whenever I find a new cool website.
Spoiler:
Image

User avatar
segmentation fault
Posts: 1770
Joined: Wed Dec 05, 2007 4:10 pm UTC
Location: Nu Jersey
Contact:

Re: worst bugs ever (or you most hated)

Postby segmentation fault » Sun Mar 09, 2008 3:40 pm UTC

any heisenbugs.

(the ones where, in trying to find the bug, you either fix it or create an entirely different one)
people are like LDL cholesterol for the internet

Lithium
Posts: 5
Joined: Tue Apr 10, 2007 4:59 am UTC

Re: worst bugs ever (or you most hated)

Postby Lithium » Sun Mar 09, 2008 4:03 pm UTC

Rysto wrote:Never, ever do a cp my_new_libc.so /lib/libc.so. Especially if my_new_libc.so is on an NFS mount. It took me hours to recover the system.

I've done this before. I'm not sure exactly what I thought was going to happen. Fortunately it was an embedded device, so I was just able to flash a clean filesystem to it.

Most annoying bug ever was a random heap corruption. Took about six hours to trace through, during which time I put trace code in all of our custom memory allocation layer, and then proceeded to manually disassemble the backtrace of internal malloc/free functions where the code was crashing, trying to correlate it against glibc source code to determine what had gone wrong, then poring over glibc's documentation to learn the in-memory format of its heap records, and finally doing memory dumps in gdb of successive heap records to find the one which had been corrupted, and deduce who had written to which bad pointer to cause it to happen.

Answer: the custom memory allocation layer we had on top was sometimes zeroing out a field in a structure after freeing it. This didn't cause errors at that point, but hosed the heap so that future heap operations in other blocks would bomb when trying to traverse the linked lists that glibc constructs inside of freed blocks.

Fix: a one-line change.

I'm completely convinced that ease-of-debugging and ease-of-fixing are always inversely proportional quantities.

User avatar
'; DROP DATABASE;--
Posts: 3284
Joined: Thu Nov 22, 2007 9:38 am UTC
Location: Midwest Alberta, where it's STILL snowy
Contact:

Re: worst bugs ever (or you most hated)

Postby '; DROP DATABASE;-- » Mon Mar 10, 2008 10:45 pm UTC

coppro wrote:
'; DROP DATABASE;-- wrote:I thought it was something dumb like that. Only thing is it worked with an older version of the library. IPC must be some crazy macro or something that got changed...
Perhaps a TransferRegion was just a char back then, so sizeof(char) returned 1, making it give that behavior?
Nope, it was definitely a struct of some sort. My best guess is this was happening all along, but it wasn't until something changed in the latest versions that it actually caused a problem.
segmentation fault wrote:any heisenbugs.

(the ones where, in trying to find the bug, you either fix it or create an entirely different one)
For me, it works like this:
1) Find bug.
2) Add debug output.
3) Bug disappears.
4) Undo all changes so that code is exactly the same as in step 1.
5) Bug doesn't reappear.
6) Goto 1 a few hours/days later.
These are almost always memory corruption, hence my initial post.

Also, compiler bugs. :P
poxic wrote:You suck. And simultaneously rock. I think you've invented a new state of being.

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: worst bugs ever (or your most hated)

Postby Berengal » Tue Mar 11, 2008 12:00 am UTC

Had a schroedingbug today:
"Yah! Complicated algorithm done! Now I just need to check these inputs... Okay, looks fine. Time to get back on the rest of the app."
Some time later:
"So, did you figure out of that problem of yours?"
"Oh yeah. Quite a masterpiece of a solution, if I might say so."
"Looking at the source here, this shouldn't work."
"What do you mean it shouldn't work? See these prints?" (I hadn't closed the testing terminal)
"That's weird, because according to this here, that should crash. Hard."
*Runs test again. No recompile, changed dataset, nothing changed at all.*
"Well fuck..."
Obviously it crashed hard. Over and over again. The original test ran 1000 data sets just fine, but since then it would consistently crash on the first set.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
Arancaytar
Posts: 1642
Joined: Thu Mar 15, 2007 12:54 am UTC
Location: 52.44°N, 13.55°E
Contact:

Re: worst bugs ever (or your most hated)

Postby Arancaytar » Wed Mar 12, 2008 2:00 pm UTC

psykx wrote:I had a bug which I fixed today it took me about 8 hours to find the error in 6 lines of PHP code


I've had wonderful fun hunting down a missing paranthesis around a boolean expression in a condition... and finding out under what circumstances the webserver recognizes "+" as an escaped space, and not...
"You cannot dual-wield the sharks. One is enough." -Our DM.
Image

Notch
Posts: 318
Joined: Tue Dec 12, 2006 5:52 pm UTC
Location: Stockholm, Sweden
Contact:

Re: worst bugs ever (or your most hated)

Postby Notch » Wed Mar 12, 2008 3:45 pm UTC

I was writing a relatively simple file cache thing, storing data in zip files, packing up as needed, and in case of a crash, cleaning up unpacked files. I committed a new version, told my co-worker to run the test (she had been waiting on me to finish up for a while) again, then turned back to look at my code.

I heard her hard-drive making funky noises, but didn't really think about it until I saw the bug.
My "ahh, noo!!" came too late. She had to re-install her OS. :-\

returnaddress
Posts: 60
Joined: Thu Mar 06, 2008 2:31 pm UTC

Re: worst bugs ever (or your most hated)

Postby returnaddress » Wed Mar 12, 2008 10:31 pm UTC

Javascript.

btilly
Posts: 1877
Joined: Tue Nov 06, 2007 7:08 pm UTC

Re: worst bugs ever (or your most hated)

Postby btilly » Thu Mar 13, 2008 4:31 am UTC

My all time favorite bug was a C program that would crash depending on the phase of the moon.

Literally.

They needed a date. Got it by calling an astronomy routine that, among other things, included the current phase of the moon. Some phases of the moon had longer descriptions than others. Some were long enough to cause a buffer overflow and hence would crash the program.

One of the more memorable ones for me was a web form that couldn't be used by people who had smaller screens. I was asked to fix it, even though someone else wrote it. I tried it. Opened my browser up wide, I could use the form. Shrank my browser window, I couldn't click on the fields. Opened it part way and I could click on some but not others. Through use of tab I could always get to any field and enter text, but if you tried to click on it you were out of luck.

Huh?

The bug? A div was being made invisible but left on the foreground. So if the div was over the form, you couldn't click on the form fields behind the invisible div.

The same guy was responsible for another fun bug. The web page will crash IE 4 (this was back when IE 4 was the dominant browser) if it is running on a modem. Will work fine from within the office. (Said web page had to be accessible remotely so this was not OK.) And when I say crash, I mean dump core.

WTF? How does a WEB page crash IE?

The answer? He had come up with the cute trick of writing to the end of the current document in JavaScript while the page was loading. It worked just fine if his write happened after the whole page had been transferred, but before it had been displayed. It crashed IE if his write happened while IE was still getting the page. Of course in the office IE would get the page much more quickly than you could working remotely off of a modem....

Oh, how about my most hated bug in Perl? That would be the behavior of

Code: Select all

my $foo if some_test();
It turns out that if some_test() is false then a necessary initialization does not happen and you get the previous value of $foo. This can be used in the construct

Code: Select all

my $foo if 0;
to get a static variable but in any Perl code base that I've seen, almost all instances of the patterns

Code: Select all

my ... if ...;
and

Code: Select all

my ... unless ...;
were the cause of occasional bugs that were very hard to track down. And those constructs always appear somewhere.

I reported this bug in 2000. Perl still does it. A patch was accepted to make this construct trigger a warning then removed from 5.8 "because it caused too many warnings". (Based on experience, virtually all were real bugs.) With 5.10 they've added state variables to provide the functionality of my $foo if 0, and added a deprecated warning for my $foo if 0. I don't think that my $foo if some_test(); generates a warning though - and that is the one whose behavior causes the real bugs that you see.

Grrrr. I should stop now.
Some of us exist to find out what can and can't be done.

Others exist to hold the beer.

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: worst bugs ever (or your most hated)

Postby EvanED » Thu Mar 13, 2008 7:00 am UTC

Here's a fun one I had to diagnose. Not my bug per se, but still interesting.

When I first installed Gentoo (or maybe not the first, but some time I installed Gentoo anyway), my computer's clock was slow. As in, it would lose time. It would lose more time when I was around, would lose little when I wasn't, and would especially lose time when I did big emerges. Windows never lost time. Gentoo lost time because... I didn't have the driver for my motherboard chipset compiled in.

The first thing to know is that PC clocks are sometimes kinda crummy. Linux actually doesn't use them except at boot. Once it's up and running, it sets up a timer interrupt on the CPU that periodically updates the OS's sense of the time, then initializes that to the HW clock. When the OS is asked for the time, it ignores the HW clock and returns the internal state, which is essentially the number of timer interrupts that have occurred since boot plus the boot time.

Now, the chipset driver. The fact that the chipset driver wasn't present meant that the kernel was not doing DMA to the hard drive, but instead the CPU was being busy doing programmed I/O. This meant that the CPU was very busy. So busy in fact that it would start losing timer interrupts.

So instead of updating the internal clock 250 times a second (or whatever), it would only update it, say, 200. And time would move 80% of its normal speed.

Of course, this would only happen when someone (me) was causing it to do I/O, such as untarring the source to a big program.

|Erasmus|
Branson
Posts: 2643
Joined: Tue Oct 30, 2007 7:53 am UTC
Location: Sydney, Australia
Contact:

Re: worst bugs ever (or your most hated)

Postby |Erasmus| » Thu Mar 13, 2008 12:49 pm UTC

When I was at work, one of the guys started doing a change for our main product ( a print driver which contained a decent chunk of postscript code), to change the compiler version from gcc 3.3.5 to gcc 4.2.2... Since he left partway through trying to do this, I inherited his change, which already had several hundred changed source files.

Now, when I inherited it, my supervisor and I went through his changes, and we found one line where a global variable had been changed from being initialised to one instead of zero. Now, since noone was quite sure what this meant, they were scared, and we changed it back.

So, what happens is that I fix the other problems we are having, and am left with getting typechecks on operator '>' in postscript whenever i run a postscript print job. After spending the best part of a day tracing back through the postscript functions, I get all the way back to this global initialised variable, which is happening to store input job parameters from the test program which runs the drivers.

The problem... it wasn't getting any of the parameters. Turns out one of the things that changed between compiler versions was where it puts global variables which have been initialised to 0. In 4.2.2 these globals are put in the B.S.S section of memory, which gets cleared at the start of every job, clobbering a whole bunch of setup due to this behaviour change. Changing the variable to 1 would fix this problem, but it was only covering up the fact that this feature of the older compiler, so it wasn't fixed with a code change. It was simply adding one extra compile flag to gcc... -fno-zero-initialized-in-bss

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: worst bugs ever (or your most hated)

Postby Berengal » Thu Mar 13, 2008 2:27 pm UTC

btilly wrote:My all time favorite bug was a C program that would crash depending on the phase of the moon.

Literally.

CERN had something similar. At regular intervals, they would get the "wrong" results from their tests. Suspecting a software bug, most likely in some date routine, they found that this was in fact happening during certain phases of the moon. Initially puzzled, they found out it wasn't a software bug at all, but the gravity of the moon actually changed the geometry of their ring enough to make a difference.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

|Erasmus|
Branson
Posts: 2643
Joined: Tue Oct 30, 2007 7:53 am UTC
Location: Sydney, Australia
Contact:

Re: worst bugs ever (or your most hated)

Postby |Erasmus| » Thu Mar 13, 2008 11:12 pm UTC

I remember back when I was not as good at writing C code as I am now... I had a program which declared/initialised a few variables, and segfaulted, before the first line of actually -doing- anything happened (was a printf). I can't actually even remember what the exact problem was, but I do remember thinking that it was rediculous at the time.

mrkite
Posts: 336
Joined: Tue Sep 04, 2007 8:48 pm UTC

Re: worst bugs ever (or your most hated)

Postby mrkite » Fri Mar 14, 2008 6:06 pm UTC

The most irritating bug I've run into is this:

I have a script called "blog.php" and an htaccess rule that says

Code: Select all

RewriteRule ^blog(/.*)?$ /blog.php$1 [L]


So I can use clean urls like /blog/42 or /blog/comment/42 etc

Problem is that on one of our servers, that doesn't work because it's got extensions optional. Meaning that without the rewrite rule going to blog will have apache pull up blog.php automatically. Pain in the ass to debug.

User avatar
wr3cktangle
Posts: 75
Joined: Tue Aug 01, 2006 5:03 pm UTC

Re: worst bugs ever (or your most hated)

Postby wr3cktangle » Sat Mar 15, 2008 3:28 am UTC

This doesn't quite fit the intended topic of the thread, but I'm sitting in bed with my laptop, and there's a ladybug that keeps dive bombing my screen and then landing somewhere in my keys while i'm typing. One of these times he'll get squished by my fingers and then I'll have bug guts on and under the keyboard and it'll release that awful smell that ladybugs release when threatened/killed.
When it's not doing this, it's banging itself off the ceiling repeatedly making an annoying click click click click click.
File this one under most hated.
Maxim 33. When faced with the unusual, self-destruct.
My blog

edge walker
Posts: 35
Joined: Thu Mar 13, 2008 5:04 pm UTC

Re: worst bugs ever (or your most hated)

Postby edge walker » Sat Mar 15, 2008 6:32 pm UTC

btilly wrote:My all time favorite bug was a C program that would crash depending on the phase of the moon.

Literally.

That reminds me of an incredibly awesome story that, while it’s not exactly a bug so is really off-topic here, everyone geeky enough to be able to appreciate it should read at some point: The case of the 500-mile email

User avatar
Yakk
Poster with most posts but no title.
Posts: 11129
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: worst bugs ever (or you most hated)

Postby Yakk » Sat Mar 15, 2008 7:48 pm UTC

My personal fav was a header file, if included in two different spots a compiled project, that would corrupt memory.

If you caused the file that was corrupting memory to recompile, it would stop.

What was going on was the header file was a #define pre-template-code template for vector mathematics. It violated the one definition rule, and it contained constructors written inside the body of a struct.

Methods in a struct are implicitly inline, and if multiple inline methods exist with the same signature only one is kept, the rest are silently discarded.

The #define changed the contents of the class from floats to doubles. At nearly random, one of the two methods are discarded. So you either get a method that thinks it is talking to a struct containing floats that actually contains doubles, or vice versa.

Hence, memory corruption and/or bad initialization depending on the order in which .o files are linked together.

coppro wrote:I have encountered, whilst using old copies of MSVC, times when the code fails to compile for no reason whatsoever! The solution is to copy the entire file, delete it, make it again, and paste the exact same contents in the new file.

This is more irritating than anything I have ever encountered anywhere else (although a mistyped < or > is irritating)


Open the file in a high end text editor.

Usually, the anomaly is a lack of a new line on the last line of the file, in my experience. :)

(By the text file standard, all text files lines must contain a new line at the end. Some people get lazy and omit it.)
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

coppro
Posts: 117
Joined: Mon Feb 04, 2008 6:04 am UTC

Re: worst bugs ever (or you most hated)

Postby coppro » Sat Mar 15, 2008 8:30 pm UTC

Yakk wrote:
coppro wrote:I have encountered, whilst using old copies of MSVC, times when the code fails to compile for no reason whatsoever! The solution is to copy the entire file, delete it, make it again, and paste the exact same contents in the new file.


Open the file in a high end text editor.

Usually, the anomaly is a lack of a new line on the last line of the file, in my experience. :)

(By the text file standard, all text files lines must contain a new line at the end. Some people get lazy and omit it.)
GCC currently gives a warning about a missing newline at the end, and I don't use the computers that experienced this bug anymore... I don't think the newline was it, though, because it was the exact same contents. I have no clue what caused it, but it managed to mess up.

User avatar
Yakk
Poster with most posts but no title.
Posts: 11129
Joined: Sat Jan 27, 2007 7:27 pm UTC
Location: E pur si muove

Re: worst bugs ever (or your most hated)

Postby Yakk » Sat Mar 15, 2008 9:05 pm UTC

If you copy/paste the file into a new file, quite often that new file will have the new line, while the original did not.

The MSVC editor is supposed to create valid text files, but sometimes screws up.

I've had your exact same problem and then examined the binary layout of the file, and confirmed it was a lack of newline at the end. Remember: an empty text file is actually a file containing nothing but a newline. So when you paste into it, you paste before the newline... :)

Abstraction leaks suck.
One of the painful things about our time is that those who feel certainty are stupid, and those with any imagination and understanding are filled with doubt and indecision - BR

Last edited by JHVH on Fri Oct 23, 4004 BCE 6:17 pm, edited 6 times in total.

User avatar
Berengal
Superabacus Mystic of the First Rank
Posts: 2707
Joined: Thu May 24, 2007 5:51 am UTC
Location: Bergen, Norway
Contact:

Re: worst bugs ever (or your most hated)

Postby Berengal » Sat Mar 15, 2008 9:45 pm UTC

So not a bug in any code I've been working on, but incredibly annoying:
While playing Oblivion, it will sometimes spontaneously crash. Not just your average freeze or CtD either, but it'll actually power off the machine completely and without warning. I have found no correlation between anything and the crashes, as they can happen at any time with any frequency. I thought it might be hardware, but temperature seems ok everywhere, my psu should be more than good enough to power everything, and it only happens in Oblivion, not any other game no matter how computationally intensive they are.
It is practically impossible to teach good programming to students who are motivated by money: As potential programmers they are mentally mutilated beyond hope of regeneration.

User avatar
lamarguerite
Posts: 210
Joined: Mon Oct 08, 2007 12:59 am UTC

Re: worst bugs ever (or your most hated)

Postby lamarguerite » Sun Mar 16, 2008 11:19 pm UTC

The Hyphenator wrote:Switch/case ftw. I've used dozens of switch/case statements, and I still always forget the goddamn breaks. ALWAYS.

This is probably because I'm new to programming, but I think just resolved a bug by taking OUT all my breaks? I don't know why.
It looks like this, and actually compiles now:

Code: Select all

switch(coin) {
         case 1:
         return pennies;
         case 2:
         return nickels;
         case 3:
         return dimes;
         case 4:
         return quarters;
        }


Also we worked with a really strange IDE during Robotics that let us declare floats only some of the time.

coppro
Posts: 117
Joined: Mon Feb 04, 2008 6:04 am UTC

Re: worst bugs ever (or your most hated)

Postby coppro » Mon Mar 17, 2008 1:25 am UTC

Because the return statement causes the function to terminate, it serves as its own break statement.

Don't know why taking it out would do anything though (unless your errors were about unreachable code).

User avatar
phlip
Restorer of Worlds
Posts: 7573
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: worst bugs ever (or your most hated)

Postby phlip » Mon Mar 17, 2008 1:26 am UTC

lamarguerite: Probably because there's a "return" there, it never has a chance to fall through to the next case statement.

I used to be in the habit of putting breaks after returns in switches anyway, just to be sure... but I stopped when I switched to compilers that would give warnings about unreachable code.

[edit] Bah, ninja'd on all points.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

Rysto
Posts: 1460
Joined: Wed Mar 21, 2007 4:07 am UTC

Re: worst bugs ever (or your most hated)

Postby Rysto » Mon Mar 17, 2008 1:54 am UTC

In Java, unreachable code is an error. Which can actually be pretty annoying.

User avatar
notzeb
Without Warning
Posts: 629
Joined: Thu Mar 08, 2007 5:44 am UTC
Location: a series of tubes

Re: worst bugs ever (or your most hated)

Postby notzeb » Mon Mar 17, 2008 5:43 am UTC

This one was aggravating because it was during a timed contest:

I had to write a hash table containing several million elements if my program to have a chance to run in time. So I made a simple linear probing hash table, tested it, everything worked fine. However, I figured the bigger the hash table was, the better, right? So I made it as big as I could without getting a runtime error, and then went on to other things.

Later on, with about half an hour left, I decided to test it out with a million things in the hash table, and try it out... it starts running, and running, and running, and five minutes later it still hasn't gotten anywhere. Not good! So I have it output "BAD" every time the linear probing takes more than 100 steps to get where it has to go. I fire it up, and within three seconds my screen is filled with "BAD"s. I replace 100 with 1000, 1000, 100000, and even 1000000, when the "BAD"s finally start coming in at the slower rate of one a second.

Frantic, I replace linear probing with double hashing. Nope, still doesn't work! Finally, in a fit of insanity, I decided to use "really big" jumps to defeat clustering, and forced the jump sizes to be between two and four million. It worked! I sent it in with 45 seconds left on the clock.

Thirty seconds after the contest I'm reading through my code and I see my initialization routine, which only sets the first two million entries of the hash table to empty... Moral of this story: NEVER USE HARD CODED CONSTANTS.
Zµ«V­jÕ«ZµjÖ­Zµ«VµjÕ­ZµkV­ZÕ«VµjÖ­Zµ«V­jÕ«ZµjÖ­ZÕ«VµjÕ­ZµkV­ZÕ«VµjÖ­Zµ«V­jÕ«ZµjÖ­ZÕ«VµjÕ­ZµkV­ZÕ«ZµjÖ­Zµ«V­jÕ«ZµjÖ­ZÕ«VµjÕ­Z

EvanED
Posts: 4331
Joined: Mon Aug 07, 2006 6:28 am UTC
Location: Madison, WI
Contact:

Re: worst bugs ever (or your most hated)

Postby EvanED » Mon Mar 17, 2008 9:26 am UTC

Rysto wrote:In Java, unreachable code is an error. Which can actually be pretty very annoying.

Fixed. ;-)


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 12 guests