Tell me, /prog/, what were the nastiest bugs you ran into?
Mine was when I coded a multithreaded Java project for university. In our group was a girl which we considered incompetent and so we only gave her lowest-tier tasks where no sentinent being should be able to cause any harm. Stuff like putting the debug output calls in comments for the final version.
The result looked like this:
void runThreads() {
while(!done) {
iteration++;
if (iteration%10000 == 0)
//Debug.out("Iteration: " + iteration + ", State: " + state.toString());
/* I'm a huge comment explaining
what the critical section does*/
syncThreads();
doCriticalStuff();
}
};
Needless to say, our debug version sometimes had incorrect output due a data race resulting from the missing synchronization. The really annoying part was that this was part of the proven, extensively tested and seemingly unchanged core program and merged alongside with a large update to peripheral functions, so we spent several days testing the graphing, output, and other stuff before finding where the problem was. And then there was a huge comment in the middle which made it easy to overlook the if-statement when looking at the seemingly important parts.