Re: My favourite timing bug
I once had to spend nearly a year debugging and fixing a prototype military system which had been delivered "tested" by a company which promptly shut down. Naturally my boss was rather perturbed that the three of us were spending so long on a "simple" job.
I was able to show that the system could not possibly have worked with the debug code in (as delivered) because it was a real time system and the debug code increased execution times to the point at which code couldn't possibly fit into the available timing. Essentially each bit of code exercising each individual bit of hardware - unit tests - worked fine in the debugger so long as you didn't notice that something that needed to happen every 10 milliseconds actually took 20 ms to execute. Put it all together and debugging was impossible, and when the debug code was taken out many things still took too long- as could only be found by scope probing every single external signal.
It was the best education I ever had.