Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I've encountered bugs that are extremely difficult to reproduce reliably and/or explain definitively, but that appear to be solved. When this happens, how much time should I spend chasing it down?

Example: this SO question and this related jQuery forum post, which offer differing solutions. The issue was reproducible intermittently until the change I discuss in the SO question, and not at all after the change.

If I don't conclusively understand what caused the bug, can I claim with confidence that it won't come back in the future by surprise?

share|improve this question
add comment

3 Answers

up vote 10 down vote accepted

If I don't conclusively understand what caused the bug, can I claim with confidence that it won't come back in the future by surprise?

No. So your next question should be: how bad will it be if it does come back by surprise?

If the answer is "pretty bad, it will cost us millions of dollars and customers" then you need to spend some time figuring it out. Best approach is to take a test environment and revert the change that you think fixed it and nothing else.

If the answer is "well, it'll be a bit embarrassing, but nothing we can't deal with" then call it a glitch for now.

share|improve this answer
add comment

In your particular case you had a race condition. There are two ways to fix that. One is to make sure one side always wins the race (the $(window).load() solution). The other is to make it so it works properly no matter who wins the race (the explicit image dimensions solution).

Usually best practices and coding standards arise out of the need to avoid such problems from cropping up in the first place. In this instance, the best practice of always explicitly specifying image dimensions applies. You found one very good reason why the hard way, and there are others you haven't encountered yet. Adding that practice to your coding standards should satisfy the suits.

share|improve this answer
add comment

If you've made a change but you're not sure why it could have fixed the bug then you can't really claim to have actually fixed the bug.

There are several ways that a change could affect a bug - assuming it doesn't actually fix the problem:

  1. You've changed the timing of some asynchronous call. If it now takes more time it's no longer trying to access the same data as some other code. The bug will reappear if the timing changes.
  2. You've moved some data around in memory so it no longer overruns a buffer into code. (Obviously this is language dependent). Again the bug could reappear at any time.
  3. The order in which variables are initialised has changed and it now works because B is initialised before A.

and so on.

You can only definitively claim a bug has been fixed if you know why the problem occurred in the first place. You admit that you "don't conclusively understand what caused the bug" so you will have to do more investigation of both the problem and the fix until you do.

share|improve this answer
    
Long ago, a programmer found out why his program worked without a splash page and not with. He was using uninitialized memory, and the three additional bytes for the subroutine call pushed the uninitialized memory being used across a 256-byte boundary, and the system set 256-byte blocks alternately to all bits 0 and all bits 1 when starting a program. –  David Thornley May 6 '11 at 21:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.