How do you reproduce bugs that occur sporadically?

前端 未结 28 1205
离开以前
离开以前 2021-01-30 19:43

We have a bug in our application that does not occur every time and therefore we don\'t know its \"logic\". I don\'t even get it reproduced in 100 times today.

Disclaime

28条回答
  •  醉梦人生
    2021-01-30 20:22

    Add verbose logging. It will take multiple -- sometimes dozen(s) -- iterations to add enough logging to understand the scenario. Now the problem is that if the problem is a race condition, which is likely if it doesn't reproduce reliably, so logging can change timing and the problem will stop happening. In this case do not log to a file, but keep a rotating buffer of the log in memory and only dump it on disk when you detect that the problem has occurred.

    Edit: a little more thoughts: if this is a gui application run tests with a qa automation tool which allows you to replay macros. If this is a service-type app, try to come up with at least a guess as to what is happening and then programmatically create 'freak' usage patterns which would exercise the code that you suspect. Create higher than usual loads etc.

提交回复
热议问题