Nils Pipenbrinck
09-23-2007, 12:38 PM
Something strange happened last friday:
I was refactoring a piece of code that initializes some hardware device. While reading the code I've noticed that something wasn't quite correct. I was writing a wrong values into a register.
Nevertheless the code was working fine for several month now, so I just wrote a little wtf-comment and planed to investigate it later.
The next time run my program to test the refactoring the initialization failed. That has never ever happend before. The code was stable for month. I did a rollback to make sure I haven't done anything stupid in my changes, but the initialization still failed. Even old executables that have the code failed.
Fixing the bug was easy: I just wrote the correct value into the register and all was nice and dandy again.
That was a scary experience. 100% Twilight Zone. This bug was in there all the time, and it was near to impossible that the code ever worked but it never caused a problem - until the very moment when I saw it in the sourcecode.
I knew that others had such bugs before: Things that are simply wrong but work fine until you are aware of them. They even have a name: Schrödingbugs
http://en.wikipedia.org/wiki/Heisenbug#Schroedinbugs
Has something like this happened to you?
Nils
I was refactoring a piece of code that initializes some hardware device. While reading the code I've noticed that something wasn't quite correct. I was writing a wrong values into a register.
Nevertheless the code was working fine for several month now, so I just wrote a little wtf-comment and planed to investigate it later.
The next time run my program to test the refactoring the initialization failed. That has never ever happend before. The code was stable for month. I did a rollback to make sure I haven't done anything stupid in my changes, but the initialization still failed. Even old executables that have the code failed.
Fixing the bug was easy: I just wrote the correct value into the register and all was nice and dandy again.
That was a scary experience. 100% Twilight Zone. This bug was in there all the time, and it was near to impossible that the code ever worked but it never caused a problem - until the very moment when I saw it in the sourcecode.
I knew that others had such bugs before: Things that are simply wrong but work fine until you are aware of them. They even have a name: Schrödingbugs
http://en.wikipedia.org/wiki/Heisenbug#Schroedinbugs
Has something like this happened to you?
Nils