Strategies to debug irreproducible bugs, or Heisenbugs

If the code in question involves concurrency, check if there is a potential for deadlocks which occurs infrequently and hard to track.

Check for other factors: network conditions, equipment quality, environment, bugs originated from OSes or third party libraries.

Add sufficient loggings to the code in case the bug appears again by detecting the bug’s behaviour, so that in the future if it appears again you will have something to track it.

Add a notification mechanism to notify you when the bug appears again, similar to previous point.

Forget about it for a while and work on other tasks, so that you can look at it from another angle later.

Have another person with fresh eyes to look at the code and give new ideas on what might cause it.

Pass many different inputs to the code with many edge cases to see if the bug can be reproduced, might be very time consuming and not effective, but can try.

If it doesn’t appear again and you have no idea how to reproduce it, maybe it’s okay to just ignore it for the time being.

 

Leave a Reply

Your email address will not be published. Required fields are marked *