worst bugs ever (or your most hated)

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

Moderators: phlip, Moderators General, Prelates

aib
Posts: 9
Joined: Wed Jan 02, 2008 11:42 am UTC

Re: worst bugs ever (or you most hated)

Postby aib » Wed Mar 19, 2008 3:36 pm UTC

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.


Argh, I _hate_ that!

Granted, it was back in CS201 when I didn't know much C++ (namespaces, overload resolution, etc.) or perhaps didn't disable precompiled headers, but recreating the project should not be the solution. Not if the original project was left with the default settings as well...

LCC-Win32 had some bugs where a simple for(int i=0; i<100; i++) { printf("%i\n", i); } would run forever (printing 0) but that was rather easy to catch and fix. (Restarting the command prompt usually did the trick)

Heap corruption, now there's something you don't want to debug. I've found that a C background helps there a bit, however, making you second guess your every memory reference, pointer arithmetic, etc.

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

Re: worst bugs ever (or your most hated)

Postby Paiev » Fri Mar 21, 2008 6:27 am UTC

I've been working through some of the USACO training problems (usaco.org; it's the USA's qualifier for the IOI. I'm hoping to take a shot at it next year; I found out about it too late to do it this year) and I kept having the stupidest bugs in my programs. The difficult stuff would work fine, mind, but the simple things wouldn't. Things like missing a ! in a conditional and using a = instead of == (g++ should give a warning for that...) consistently make me go *facedesk*. Not really the worst bugs ever, but it's a PITA to consistently have these stupid mistakes in my programs.

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

Re: worst bugs ever (or your most hated)

Postby Rysto » Fri Mar 21, 2008 3:59 pm UTC

Paiev wrote:using a = instead of == (g++ should give a warning for that...)

It does. Trying turning on warnings.

User avatar
CMTG
Posts: 8
Joined: Sun Dec 03, 2006 3:36 pm UTC
Location: The Grim North
Contact:

Re: worst bugs ever (or your most hated)

Postby CMTG » Fri Mar 21, 2008 7:30 pm UTC

I work in telemetry.

As a testament to how grim the weather is in the north of England, it has taken four months (from when I first wrote the code) for the following bug to emerge on the test system: Crash getting lowest cloud layer height when there are no cloud layers.

Can you imagine? Clear sky!

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

Re: worst bugs ever (or your most hated)

Postby phlip » Tue Mar 25, 2008 8:17 am UTC

CMTG wrote:Can you imagine? Clear sky!

Clear sky in England is a glitch in the matrix.

Also, Paiev:
g++ -Wall wrote:test.cpp:3: warning: suggest brackets around assignment used as truth value

Code: Select all

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

aib
Posts: 9
Joined: Wed Jan 02, 2008 11:42 am UTC

Re: worst bugs ever (or your most hated)

Postby aib » Fri Apr 04, 2008 12:22 pm UTC

Flash, ActionScript 3.0, regarding switch/case on XML nodes:

Code: Select all

switch (myxml.somenode) {
    case "title":
        ...
        break;
    case "somethingelse":
        ...
        break;
}


...doesn't work. However,

Code: Select all

if (myxml.somenode == "title") { ... } else if (myxml.somenode == "somethingelse") { ... }


works. I think it has something to do with comparing an XML node against a string, but if the equivalent if..else syntax works, the switch should too, shouldn't it?

Actually I've found more bugs in AS3.0 than I care to remember right now. I've found that it's not a good language to try to develop an _application_.

rabuf
Posts: 15
Joined: Thu Mar 20, 2008 2:30 pm UTC

Re: worst bugs ever (or your most hated)

Postby rabuf » Fri Apr 04, 2008 1:32 pm UTC

For ActionScript 3.0's switch/case see switch/case definition and strict equality. According to these, your switch/case code is actually equivalent to:

Code: Select all

if (myxml.somenode === "title") {...} else if (myxml.somenode === "somethingelse") {...}


The difference is '===' instead of '=='. According to the second link, equality will convert objects between types to make comparisons, while strict equality does not. Further reading at flash XML suggests to me that perhaps '==' executes myxml.somenode.toString(). I can't test this myself, but try adding that call into the switch(..) statement.

User avatar
Amnesiasoft
Posts: 2573
Joined: Tue May 15, 2007 4:28 am UTC
Location: Colorado
Contact:

Re: worst bugs ever (or you most hated)

Postby Amnesiasoft » Sat Apr 05, 2008 3:26 am UTC

coppro wrote:I have encountered, whilst using old copies of MSVC

Speaking of Microsoft and C, their C compiler generates all sorts of errors if all of your variables are not declared right at the beginning of a function.

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

Re: worst bugs ever (or you most hated)

Postby EvanED » Sat Apr 05, 2008 5:35 am UTC

Amnesiasoft wrote:
coppro wrote:I have encountered, whilst using old copies of MSVC

Speaking of Microsoft and C, their C compiler generates all sorts of errors if all of your variables are not declared right at the beginning of a function.

That's because MS is apparently not a fan of C99.

User avatar
niteice
Posts: 186
Joined: Wed May 02, 2007 4:17 am UTC
Contact:

Re: worst bugs ever (or your most hated)

Postby niteice » Sat Apr 05, 2008 6:20 am UTC

On the subject of MSVC, the optimizer was updated for VC2008 - in fact, updated so well that some expressions make it segfault!

Code: Select all

dist = c_x / tan( M_PI * scaled_fov / 360.0 );
must become

Code: Select all

float dist_denom = tan(M_PI * scaled_fov / 360.0f);
dist = c_x / dist_denom;

(for the curious, that comes from Valve's Source SDK)
GENERATION 4294967292: The first time you see this, copy it into your sig on any forum, negate the generation, and convert it to a 32-bit unsigned integer. Social experiment.

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

Re: worst bugs ever (or your most hated)

Postby Paiev » Sun Apr 06, 2008 12:13 am UTC

I hate MSVC6 so much...I can't believe it's still around. It basically says "screw you" to the standard. I have to take quizzes on it during school and it pisses me off to no end when

Code: Select all

for (int i = 0; ...)
{
...
{
...
for (int i = 0; ...)
{
...
}


doesn't work.

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 » Sun Apr 06, 2008 2:31 am UTC

Paiev wrote:I hate MSVC6 so much...I can't believe it's still around. It basically says "screw you" to the standard.

MS deserves a lot of crap for standards compliance, but VC6 is a rare exception of when it probably gets more hate than it deserves. Sure, the standards compliance on it is crappy, but based on what I know of the release date of it and the standard, there's about an 2/3 chance that VC6 was released before the standard was published, and about a 50-50 chance that it was released before the standard was ratified. (Both were released in 1998. I can't pin down the release of VC6 to closer than that. The standard was published on Sept 1, and ratified sometime over summer.)

There were draft standards, and I'm sure that it was known years before that the behavior of a declaration in a for loop was likely to be changed, but at the same time, C++ is a huge language, and it's more likely that this issue was just low on the priority list.

At any rate, I don't think it was a deliberate decision to be non-conforming like so many of MS's other endeavors are.

There are two workarounds I know of which may be more palatable than changing variable names. The first is to add a new scope:

Code: Select all

{
  for (int i = 0; ...)
  {
  ...
  }
}
...
{
  for (int i = 0; ...)
  {
  ...
  }
}

The second, which is clever in every implication, is to use the following macro:

Code: Select all

#define for if (0); else for

(I found that on a site I was looking at. I don't know of any substantial downside, though it may give a warning about a constant conditional or something similar.)

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

Re: worst bugs ever (or your most hated)

Postby Yakk » Sun Apr 06, 2008 7:05 am UTC

Code: Select all

{for(...) {
  // ..
}}

is also reasonably clean looking.
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.

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

Re: worst bugs ever (or your most hated)

Postby Paiev » Sun Apr 06, 2008 6:48 pm UTC

EvanED wrote:
Paiev wrote:I hate MSVC6 so much...I can't believe it's still around. It basically says "screw you" to the standard.

MS deserves a lot of crap for standards compliance, but VC6 is a rare exception of when it probably gets more hate than it deserves. Sure, the standards compliance on it is crappy, but based on what I know of the release date of it and the standard, there's about an 2/3 chance that VC6 was released before the standard was published, and about a 50-50 chance that it was released before the standard was ratified. (Both were released in 1998. I can't pin down the release of VC6 to closer than that. The standard was published on Sept 1, and ratified sometime over summer.)


I don't blame Microsoft as much for being non-compliant because of the release date of the standard, as you said, but I rather blame the school for using a ten-year-old, non-compliant compiler to teach people on. There's no reason at this point to use VC6, and especially to use it to teach people how to code incorrectly.

Another qualm that I have with it is that it will sometimes glitch and compile infinitely for no reason whatsoever. The solution to this is to open up a new window, since the program cannot be killed (no access to task manager, so the only way to kill it would be to log out and log back in, which takes too much time when you're taking a quiz).

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 » Sun Apr 06, 2008 6:59 pm UTC

Paiev wrote:Another qualm that I have with it is that it will sometimes glitch and compile infinitely for no reason whatsoever. The solution to this is to open up a new window, since the program cannot be killed (no access to task manager, so the only way to kill it would be to log out and log back in, which takes too much time when you're taking a quiz).

Try ctrl-break. I can't try it now, but I think that kills the current build.

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

Re: worst bugs ever (or your most hated)

Postby Yakk » Sun Apr 06, 2008 7:19 pm UTC

Download the psutilities from microsoft sysinternals?
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
phlip
Restorer of Worlds
Posts: 7569
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: worst bugs ever (or your most hated)

Postby phlip » Sun Apr 06, 2008 9:42 pm UTC

Paiev wrote:Another qualm that I have with it is that it will sometimes glitch and compile infinitely for no reason whatsoever. The solution to this is to open up a new window, since the program cannot be killed (no access to task manager, so the only way to kill it would be to log out and log back in, which takes too much time when you're taking a quiz).

Is it just me, or does the concept of teaching new programmers (who are liable to make all the usual new-programmer mistakes, like, to pick an example at random, infinite loops) to program on a computer without access to some way of killing processes (like, to pick an example at random again, a process in an infinite loop) seem to be a bad idea?

That said, you don't need Task Manager to kill stuff... run a command prompt and run tskill /? (on Vista, taskkill /?... don't ask me why, but they changed the name, and most of the parameters). If you don't have access to the command prompt either, look it up at home, and just use the Start->Run box at school. If they've blocked that too... I'd seriously consider complaining to someone...

Code: Select all

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

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

Re: worst bugs ever (or your most hated)

Postby Yakk » Sun Apr 06, 2008 9:55 pm UTC

Compiling a program that runs a command-line program isn't hard. :)
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
bitwiseshiftleft
Posts: 295
Joined: Tue Jan 09, 2007 9:07 am UTC
Location: Stanford
Contact:

Re: worst bugs ever (or your most hated)

Postby bitwiseshiftleft » Mon Apr 07, 2008 12:51 am UTC

Java maps. I was writing a subclass of Java's AbstractMap<K,V> class, and I wrote:

Code: Select all

V get(K key) {
  //...stuff...
}
The code worked approximately correctly, but it was performing poorly. I tried putting some prints in the get(key) code, and discovered that my get(key) wasn't being called at all! Turns out Map (and AbstractMap) defines:

Code: Select all

V get(Object key);
which my method didn't override. So it defaulted to using entrySet(), which is, of course, vastly more expensive than get(key). Of course, to fix it, I wrote something like:

Code: Select all

V get(Object key) {
  try {
     return get((K) key);
  } catch (ClassCastException e) {
     return null;
  }
}
And they wonder why people hate Java...

User avatar
Strilanc
Posts: 646
Joined: Fri Dec 08, 2006 7:18 am UTC

Re: worst bugs ever (or your most hated)

Postby Strilanc » Mon Apr 07, 2008 5:34 am UTC

Any bug ever caused by "Option Explicit" not being at the top of a VB file. I don't care if they didn't include Option Explicit, it should still be an error to use an undeclared value on the right side of an equation.

value_with_long_name = value_with_l0ng_name + 1 'haha did you see the typo? Better look for it for hours.
Don't pay attention to this signature, it's contradictory.

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 » Mon Apr 07, 2008 2:20 pm UTC

Strilanc wrote:value_with_long_name = value_with_l0ng_name + 1 'haha did you see the typo? Better look for it for hours.

And of course

Code: Select all

int i = 1234 + 432l; // Not 5555
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
Strilanc
Posts: 646
Joined: Fri Dec 08, 2006 7:18 am UTC

Re: worst bugs ever (or your most hated)

Postby Strilanc » Mon Apr 07, 2008 4:29 pm UTC

Berengal wrote:
Strilanc wrote:value_with_long_name = value_with_l0ng_name + 1 'haha did you see the typo? Better look for it for hours.

And of course

Code: Select all

int i = 1234 + 432l; // Not 5555


The 'code' view doesn't differentiate that L from the 1 at all. I had no idea what the problem was until I hit reply and could see it in a different font.
Don't pay attention to this signature, it's contradictory.

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 » Mon Apr 07, 2008 5:13 pm UTC

The problem stems from code always being viewed in the same font, and in that font the difference between 1 and lowercase-L is just one pixel. Add to that the fact that 432L is a valid number in most languages (that supports a difference between long and int anyway (for example, python does, but won't in 3k, which will make that invalid syntax)), and you have a recipe for disaster.
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
evilbeanfiend
Posts: 2650
Joined: Tue Mar 13, 2007 7:05 am UTC
Location: the old world

Re: worst bugs ever (or your most hated)

Postby evilbeanfiend » Mon Apr 07, 2008 5:46 pm UTC

trwtf(tm) is that every language designer and their dog copies c syntax despite everyone knowing that it is atrocious.
in ur beanz makin u eveel

User avatar
Xanthir
My HERO!!!
Posts: 5401
Joined: Tue Feb 20, 2007 12:49 am UTC
Location: The Googleplex
Contact:

Re: worst bugs ever (or your most hated)

Postby Xanthir » Mon Apr 07, 2008 6:11 pm UTC

Berengal wrote:The problem stems from code always being viewed in the same font, and in that font the difference between 1 and lowercase-L is just one pixel. Add to that the fact that 432L is a valid number in most languages (that supports a difference between long and int anyway (for example, python does, but won't in 3k, which will make that invalid syntax)), and you have a recipe for disaster.

See, that's why you should do your programming in Georgia. ^_^


My most-hated bug caused me to blow about 3 hours of productive time on it, and go home really late to boot. At the very end of a php script I used a string literal, but forgot to close it. The only thing that came after it were some close braces and the closing tag. This caused an exception to be thrown about an invalid tend encountered (I think), that I couldn't figure out. I checked and doublechecked all my loops (as omitting a close brace is the usual cause of this). I stepped through it manually. I passed it through a code formatter to try and uncover any weirdly-formed code that my indentation was hiding. I even used a code colorer that showed nothing unusual.

It wasn't until I gave up on it and decided to improve the code-colorer I found that I discovered my error. It turns out that the shades of red and green that the code colorer used (for coloring string contents and arbitrary code, respectively) were very nice on the eyes but very difficult to distinguish in small amounts, such as a single brace per line and a small closing tag. This was compounded by my mild blue-green colorblindness, which tends to brown-ify that shade of green. My changes to the colorer forced it to bold all the colored text and use the extreme versions of each color (#f00 and #0f0, respectively), which *finally* made it blindingly obvious what was wrong with my code.

On the plus side, I fixed the colorer code to work properly with php5 and updated the guy I got it from, who was very appreciative, so it wasn't a complete loss. Reduction of internet entropy ftw!
(defun fibs (n &optional (a 1) (b 1)) (take n (unfold '+ a b)))

User avatar
TomBot
Posts: 228
Joined: Sun Jul 29, 2007 1:17 am UTC
Location: Illinois (UIUC)
Contact:

Re: worst bugs ever (or your most hated)

Postby TomBot » Mon Apr 07, 2008 7:07 pm UTC

|Erasmus| wrote: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

The C nerd in me is curious - what is the difference in behavior that produces? I would not expect a global variable to be initialized or clobbered at any time other than in _start (before main()).


A few nights ago I was up really late coding, and finally gave up when I couldn't figure out this bug:

Code: Select all

size_t FrameBuffer::getSize()
{
   size_t ret = 0;
   pthread_mutex_lock(&buffer_lock);
   bool slowest_thread_pos = getLowestNextFrame();
   u_int64_t max_id = buffer.rbegin()->first;
   ret = max_id - slowest_thread_pos;
   pthread_mutex_unlock(&buffer_lock);
   return ret;
}

The next morning I was alert enough to spot the misplaced bool. But what really irks me is that the compiler (GCC 4.2 with -Wall) helpfully converted slowest_thread_pos to an int (as 1 if it was nonzero) but didn't warn about the bool->int conversion at all. WTF?

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

Re: worst bugs ever (or your most hated)

Postby coppro » Mon Apr 07, 2008 11:11 pm UTC

TomBot wrote:The next morning I was alert enough to spot the misplaced bool. But what really irks me is that the compiler (GCC 4.2 with -Wall) helpfully converted slowest_thread_pos to an int (as 1 if it was nonzero) but didn't warn about the bool->int conversion at all. WTF?
And here's me getting annoyed with getting tons of narrowing conversion warnings for writing "int i = some_double" in a program that does 2D rendering (so lots of doubles) with an underlying library that uses ints. Lots of narrowing conversions, and every single one being warned about.

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

Re: worst bugs ever (or your most hated)

Postby Yakk » Tue Apr 08, 2008 12:45 am UTC

TomBot wrote:
|Erasmus| wrote: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

The C nerd in me is curious - what is the difference in behavior that produces? I would not expect a global variable to be initialized or clobbered at any time other than in _start (before main()).


I suspect absolute eramus was doing something decidedly non-standard, like running the C program multiple times, and expecting global variables to keep state between cycles.

Either that, or they where writing over the BSS segment in non-C code.

A few nights ago I was up really late coding, and finally gave up when I couldn't figure out this bug:

Code: Select all

size_t FrameBuffer::getSize()
{
   size_t ret = 0;
   pthread_mutex_lock(&buffer_lock);
   bool slowest_thread_pos = getLowestNextFrame();
   u_int64_t max_id = buffer.rbegin()->first;
   ret = max_id - slowest_thread_pos;
   pthread_mutex_unlock(&buffer_lock);
   return ret;
}

The next morning I was alert enough to spot the misplaced bool. But what really irks me is that the compiler (GCC 4.2 with -Wall) helpfully converted slowest_thread_pos to an int (as 1 if it was nonzero) but didn't warn about the bool->int conversion at all. WTF?
Last edited by Yakk on Tue Apr 08, 2008 5:09 pm UTC, edited 1 time in total.
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.

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

Re: worst bugs ever (or your most hated)

Postby Rysto » Tue Apr 08, 2008 6:21 am UTC

I wrote a garbage collector as part of my runtime for a compiler that I wrote. It was all done in C++, so before trying to have a program compiled from my program use the runtime I wrote a small test program in C that used the memory allocation interface. I ran into the most godawful bug, though: some of the pointers were getting mangled. I spent forever going through the garbage collector trying to figure out what it was doing wrong. I finally found the problem: the test program broke C's pointer aliasing rules in horrible ways(the test program had to manually create frames for the garbage collector so that the collector could find the GC roots). I didn't have optimizations on so I didn't think that it would be an issue, but evidently it was.

I never seem to learn this simple lesson: never assume that the test is correct!

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 Apr 08, 2008 10:56 am UTC

Rysto wrote:I never seem to learn this simple lesson: never assume that the test is correct!

I've been badly burned by this as well. I used to go all out on the tested classes and methods whenever a unittest would fail, but usually the bug would be found just a couple of minutes after returning to the test code after spending possibly hours on the implementation.

I've learned to start tests out simpler, so as to remove any doubt that the basic elements of the code works. For example, when testing a method that would insert elements into a sorted list, I would first check that it correctly inserted elements that should be first first, last last and neither neither. Only then could I go all out trying to break the sorting algorithm.
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.

illabled
Posts: 3
Joined: Mon Apr 07, 2008 4:03 am UTC

Re: worst bugs ever (or your most hated)

Postby illabled » Tue Apr 08, 2008 4:55 pm UTC

Nvu. nuff said.

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

Re: worst bugs ever (or your most hated)

Postby segmentation fault » Tue Apr 08, 2008 5:35 pm UTC

i just had a huge facepalm moment.

i should remember that bzero is a useful function. especially when youre relying on null termination.

EDIT: ok fine memset is the useful function here. bzero is deprecated and since i dont want to deal with being called a lousy developer because of semantics ill use memset w/e.
people are like LDL cholesterol for the internet

User avatar
biolution
Ken
Posts: 560
Joined: Wed Sep 05, 2007 10:05 pm UTC
Location: San Francisco, Ca
Contact:

Re: worst bugs ever (or your most hated)

Postby biolution » Wed Apr 09, 2008 2:57 am UTC

Fun bugs:

Database crash because its log file filed up the hard drive
... causing the Appserver crash because the "database went away"

Appserver crash because *its* log file filled up the hard drive
Appserver crash because someone sent a very special email (we never did find out why it crashed the server)
Appserver crash because the client crashes because of a bug in its library with large file transfers
Appserver crash because...we don't know. It just dies randomly (typical windows server, eh?).

Tomcat crash because...we never found out. Fix: restart it every hour with a cron!
Tomcat crash because log file filled up the disk.
...filed up because the results of queries were being logged to disk. This was a reporting application.

Database crash because email was creating too many records
...Email was creating too many records because our system and another system were replying to each other's automated emails
...Database crashed caused the appserver to crash
...After the database crashed, emails queued up on disk
......thankfully we had plenty of diskspace
......but it kept trying to process all the emails, so everytime the dba's brought it up, it promptly died.
...during all of that, the webfront end was mostly useless

On one occasion, after going through several crashes, we set up monitoring.
...it promptly crashed
...silently, we don't know when, we didn't know until we wondered why it didn't notify us of one of the above crashes
...the irony is we were completely spammed by test email when setting it up, so most of us would automatically-archive the notices

My favourite php one: downloading attachments breaks because of a trailing newline in one of the 100's of files included.

User avatar
Gatesunder
Posts: 120
Joined: Sat Feb 09, 2008 11:24 pm UTC
Location: KSU

Re: worst bugs ever (or your most hated)

Postby Gatesunder » Thu Apr 10, 2008 2:24 am UTC

My current most hated bug is one in which the compiler keeps telling me a variable isn't declared in the scope it's in when it's declared right about where it's first used. The annoying part is that it doesn't complain at all about me using the variable the line below the line it's complaining about. Here's an example

Code: Select all

Node< T > * x = new Node< T >( data );
blargh[ i ] = x;


I forget what the other line is that it's not complaining about, but the thing it is complaining about is x, saying it's not declared in this scope on the second line, but doesn't say anything about the line it's declared on. I honestly cannot wrap my head around it no matter how many times I go over the code trying to see if it's coming from somewhere else. *shrug*
I'm wrong 99% of the time, but some day that 1% will be better than the rest ...

User avatar
markfiend
Posts: 504
Joined: Fri Jul 06, 2007 9:59 am UTC
Location: UK (Leeds)

Re: worst bugs ever (or your most hated)

Postby markfiend » Fri Apr 11, 2008 8:59 am UTC

Not so much a bug as a 'feature' but...

I'm programming a web app; my testing environment has php5, but the server I will be deploying on has php4. Don't ask why, I don't know, and I'm not allowed to upgrade. And that's not even the 'hated' bit:

In php4, when you instantiate a new object, it doesn't automatically call the class's constructor method. :evil:
advanced, forthright, signifficant
pronouns: he/him

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

Re: worst bugs ever (or your most hated)

Postby Yakk » Fri Apr 11, 2008 4:36 pm UTC

Read-side fencepost error.

For it to cause a problem, the fencepost has to be directly adjacent to a memory segment that is invalid to read from. Which happens ... rarely.

It also never causes an error in debug, because of the "detect memory corruption" buffers on each side of a memory block.

So the memory has to be allocated in a particular spot, at the "high water mark" of your heap, with a particular alignment, and then go through a particular bugged execution path, all in release, and it doesn't happen reproducibly.

That was a bitch.

Worst part? The error message was very clear, but I assumed it must have been a bad/corrupt pointer, so I spent an age trying to figure out how the pointer got corrupted... If I could have read the variables (most of which where optimized away) I would have gotten it in seconds. :/
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
biolution
Ken
Posts: 560
Joined: Wed Sep 05, 2007 10:05 pm UTC
Location: San Francisco, Ca
Contact:

Re: worst bugs ever (or your most hated)

Postby biolution » Fri Apr 11, 2008 5:31 pm UTC

markfiend wrote:In php4, when you instantiate a new object, it doesn't automatically call the class's constructor method. :evil:


Offtopic:
Spoiler:
Eh? It does. Php4 and php5 have different constructor names, though. In php5, __construct is called, if it doesn't exist, ClassName() is called (if it exists, otherwise it walks up the inheritance hierarchy). In php4, only ClassName() is called. If you're talking about deriving a class, not defining a constructor in the child, and then the parent constructor isn't invoked, ya, I think I read a comment about that happening.

User avatar
enk
Posts: 754
Joined: Mon Sep 10, 2007 12:20 am UTC
Location: Aalborg, Denmark
Contact:

Re: worst bugs ever (or your most hated)

Postby enk » Fri Apr 11, 2008 10:06 pm UTC

At my job, this ancient CRM program called Goldmine is used. When exporting some stuff for use in MS Excel it comes out as plain text with fields delimited by double quotes and separated by commas. Double quotes are not escaped :x , neither are linebreaks (I dunno why one would cram text areas into table cells anyway). Tbh, I haven't seen the exporting options (if there are any), I've just seen the resulting text file.


I "solved" this with the the most hackish solution I think I've ever "solved" something with. It escapes the quotes and and turns multi line fields into strings, substituting the linebreaks with "<BR>", so you can see where they used to be.

Spoiler:
I wrote this one line worth of line noise:

Code: Select all

0V/\(,"[^"]\{-}"\)\{4}$^M:v/\(,"[^"]\{-}"\)\{4}$/s/$/<BR>/^Mgv:s/"\(,"[^"]\{-}"\)\{4}$/\r&/^MgvjVgv:v/^\("[^"]\{-}",\)\{7}\|\(,"[^"]\{-}"\)\{4}$/s/"/""/g^Mgv:j!^M^M


which has to be applied as a vim macro to every exported file as many times as there are rows in the exported material (of course you only have to use a count to make vim execute the macro a specified number times). If you look closely there's some redundancy, but reducing that would have made the whole thing even less elegant.

Maybe, if I knew how to join lines with regex substitution, it would have been a bit less un-elegant. But, tbh, it looks really really cool crunching away :)
phlip wrote:Ha HA! Recycled emacs jokes.

User avatar
biolution
Ken
Posts: 560
Joined: Wed Sep 05, 2007 10:05 pm UTC
Location: San Francisco, Ca
Contact:

Re: worst bugs ever (or your most hated)

Postby biolution » Sat Apr 12, 2008 4:28 am UTC

enk wrote:At my job, this ancient CRM program called Goldmine is used. When exporting some stuff for use in MS Excel it comes out as plain text with fields delimited by double quotes and separated by commas. Double quotes are not escaped :x , neither are linebreaks (I dunno why one would cram text areas into table cells anyway). Tbh, I haven't seen the exporting options (if there are any), I've just seen the resulting text file.


I "solved" this with the the most hackish solution I think I've ever "solved" something with. It escapes the quotes and and turns multi line fields into strings, substituting the linebreaks with "<BR>", so you can see where they used to be.

Spoiler:
I wrote this one line worth of line noise:

Code: Select all

0V/\(,"[^"]\{-}"\)\{4}$^M:v/\(,"[^"]\{-}"\)\{4}$/s/$/<BR>/^Mgv:s/"\(,"[^"]\{-}"\)\{4}$/\r&/^MgvjVgv:v/^\("[^"]\{-}",\)\{7}\|\(,"[^"]\{-}"\)\{4}$/s/"/""/g^Mgv:j!^M^M


which has to be applied as a vim macro to every exported file as many times as there are rows in the exported material (of course you only have to use a count to make vim execute the macro a specified number times). If you look closely there's some redundancy, but reducing that would have made the whole thing even less elegant.

Maybe, if I knew how to join lines with regex substitution, it would have been a bit less un-elegant. But, tbh, it looks really really cool crunching away :)


I hope you know that you're going to hell for writing that regex. Like, the deep levels, where you don't even have perl regular expressions.

User avatar
enk
Posts: 754
Joined: Mon Sep 10, 2007 12:20 am UTC
Location: Aalborg, Denmark
Contact:

Re: worst bugs ever (or your most hated)

Postby enk » Sat Apr 12, 2008 1:22 pm UTC

biolution wrote:I hope you know that you're going to hell for writing that regex. Like, the deep levels, where you don't even have perl regular expressions.



Yeah, I had the feeling :)

It's not just one regex, though. It's three regex substitutions on lines selected by other regexes as well as a few basic vim commands.

What parts (besides all of it) are offending?
phlip wrote:Ha HA! Recycled emacs jokes.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 6 guests