Thursday, May 29, 2008

Awesome User Error:

This is going to be a very confusing story about an awesome error I inflicted on myself.

I've been testing a program whose name I'm probably not permitted to tell you, but the name is similar to “Task Manager”. You're probably familiar with the Task Manager program, you can use it to turn your PC off, to list the processes that are running, to see how much CPU time you're using, and even to “kill” programs that won't quit when you want them to.

I've been fixing a bug that works like this: my own program tries to quit, but a little piece of it keeps running. I can see, in Task Manager, that my program has a running “process”. My program won't start again unless that process quits. The worst part of the bug was that sometimes Task Manager couldn't “kill” it. I would have to reboot the PC to get rid of it. So you can imagine that each time my program quit, I looked anxiously at the list of processes in Task Manager, to see if my program was gone.

This was a very rare issue until, sometime today, my brain fused the names of my program with “Taskmgr” -- that's how Task Manager appears in the “process” list -- and I started running Task Manager to see whether “Task Manger” was running.

Now of course it always was! So I thought that my bug had become repeatable. Worse, when I told Task Manager to kill Task Manager, the strangest thing happened: Task Manager disappeared right off the screen. And if I ran it again to see if it had managed to kill MY program (which wasn't even running anymore), why ... there was Task Manager again, right in its list of running processes!

The first time I told it to kill itself (thinking I was telling it to kill MY program), I was astounded when Task Manager disappeared. “WOW!” I said, “My program is so hard to kill that Task Manager dies, trying to kill it.” Hours later, the silver coin dropped, and I realized that every time Task Manager had disappeared, my program had not been running, and my bug was not happening.

It's a peculiar thing, though, that Task Manager is allowed to kill itself. I'll bet the person who wrote that program thought hard about whether to allow it to commit suicide.

No comments: