Geeks With Blogs


View Anthony Trudeau's profile on LinkedIn

Add to Technorati Favorites

Anthony Trudeau

I received an email this morning from my manager saying that I need to look at this one utility, because it's showing a high CPU utilization and preventing another application from running.  The utility runs on a Terminal Server so the problem is exaserbated by multiple users in different sessions.

Keep in mind that this utility has been in production for several months and there have been zero bug reports.  But, sure enough using the information I was able to duplicate the problem and based on the details of the problem I knew what function was causing the problem and I quickly saw the problem:

      // wait for a signal from AddRequest, ClearError, or the Stop method

      if (_disposed)

          _waitHandle.WaitOne(timeout, false);


 A half a day of work lost, because I messed up the logic and should have said, "if (!_disposed)".  Oh well, it seems that no matter how well you think you test the code that there's always the possibility of something funny like this that you don't look for.  I feel comfortable saying that the utilty is still well tested since its not a trivial utility and I've only had one bug report.  But, I still feel like slapping myself for that funny little logic error.

Anyone else do these funny little logic errors?

Posted on Monday, March 10, 2008 4:48 AM .NET | Back to top

Comments on this post: Funny Little Logic Errors

# re: Funny Little Logic Errors
Requesting Gravatar...
Yep. A colleague of mine once wasted untold hours (days even) chasing down a double not. We code reviewed, tested, debugged, yada yada. When he found it we couldn't believe the probem... we'd stared at those lines of code for so long and not picked up on it :)
Left by Dan F on Mar 18, 2008 3:12 PM

Your comment:
 (will show your gravatar)

Copyright © Anthony Trudeau | Powered by: