57

There is a big amount of times when we code something that yields a heisenbug. An example of this is OpenERP 7, in the sense that you install a module and SOMETIMES when you try to trigger an action by clicking a menu item, the sidebar disappears. Most of the times, you reinstall the conflicting module (without doing any distinct step), and it works. Quite unstable in my opinion, but widely used.

In the How to ask a good question guidelines (and also in the "V" part of mcve guidelines), the 4th paragraph recommends people to give a reproducible example or hints on how to reproduce the problem.

How do I ask a question when the problem involves a heisenbug (i.e. a bug that appears randomly)?

5
  • 42
    You can't - it's pointless. You will only get an answer if you don't ask the question. Commented Dec 16, 2014 at 18:57
  • 32
    You don't need to ask the question. You have already either gotten an answer or not. In fact, both. All you have to do is look and see which it is, thus causing the answer to appear (or not).
    – matt
    Commented Dec 16, 2014 at 20:21
  • 11
    See also: Can I ask a question about a problem I cannot reliably reproduce?
    – Air
    Commented Dec 16, 2014 at 20:23
  • 19
    My view of a heisenbug is not that it appears randomly. I think the first sentence of the wikipedia article you linked describes a heisenbug: "a heisenbug is a software bug that seems to disappear or alter its behavior when one attempts to study it." This is not "random". It may be quite reproducible and deterministic. The problem arises when print statements are inserted, a debugger is used, or other code modifications are made to study it. Then it becomes unreproducible. Such heisenbugs are entirely on-topic (IMO), and it's often quite possible to provide an MCVE for them. Commented Dec 17, 2014 at 16:32
  • 2
    Are you certain? Commented Dec 17, 2014 at 19:30

2 Answers 2

50

The best advice I would offer is to present as much debugging information as you have been able to gather in your question. Heisenbugs are certainly not off-limits or off-topic, and you're doing the right thing by being concerned about the How to Ask guidelines.

Just be as detailed as possible in your explanation:

  • When X is present, bug sometimes occurs
  • But when Y is present, bug never occurs
  • When X and Y are both present, bug seems to occur more often than X alone
  • I have verified that software versions A, B, C are consistent and up to date
  • Here are the logs I have gathered of the bug situation
  • And here are comparable log lines of a nominal state

Hopefully you get the idea. A good question is one that shows research effort. Even if it doesn't feel like it is totally reproducible, answerers will be able to share ideas with you if given sufficient detail to start from.

10
  • Thanks. I was looking for these border-case guidelines :). Althought it will be a huge effort for my case (I'm totally n00b @ OpenERP, and people by my side have no clue on these cases - additionally, no logs are present there when the error occurs) :(. Commented Dec 16, 2014 at 14:46
  • 2
    I think you mighted need to do more than that. Here's one of my heisenbug questions that got downvoted and close-voted.
    – simonzack
    Commented Dec 16, 2014 at 20:39
  • 1
    I just can't see a question like this actually surviving. It violates "Questions seeking debugging help..." pretty blatantly. In my experience, these questions always get closed.
    – Kirk Woll
    Commented Dec 16, 2014 at 20:49
  • 2
    @KirkWoll Depends on the tag, I suppose. If it is an interesting problem that is well explained in a tag where a lot of experienced people hang out, it will get attention. If it is a "why doesn't this work" question in PHP or Android or JavaScript, it will get closed (not to say experienced people don't hang out in those tags, but the debugging questions brought there tend not to be interesting) Commented Dec 16, 2014 at 20:52
  • 3
    @KirkWoll IMHO the reasons most of those being closed is not due to them being a debugging question per se, but due to being an extremely basic one.
    – simonzack
    Commented Dec 16, 2014 at 21:20
  • 1
    Can a Heisenbug even be a good question? How likely is the answer -if you even get one- going to be to other people?
    – Sled
    Commented Dec 18, 2014 at 14:50
  • 2
    @KirkWoll IMHO you're taking "debugging help" too literally. It surely aims at people too lazy to start the debugger rather than on those trying hard to rescue the Schrödinger's cat.
    – maaartinus
    Commented Dec 19, 2014 at 0:04
  • 1
    @maaartinus, no, I think you don't understand what that close reason is for. Whether it should eliminate this sort of question is open to debate, but it certainly does not exist merely to close questions by people who haven't even tried to debug.
    – Kirk Woll
    Commented Dec 19, 2014 at 0:40
  • @KirkWoll I often read things the way I feel they should be, which is not always the way they were meant (it mostly works, saves quite some time, and sometimes leads to a better outcome). Now I looked at it and I'd interpret the part "the shortest code necessary to reproduce it" as ".. reproduce it as often as possible" for a randomly occurring bug. The asker is asked to ask a question in a way that helps to answer it and helps others. For a heisenbug, this is hard, but there may be a widely applicable answer showing how to increase the reproducibility.
    – maaartinus
    Commented Dec 19, 2014 at 1:58
  • @maaartinus, I still don't agree with your conclusion, but now we disagree for the right reasons. :) (the part I think is open to debate) That being said, I agree with ArtB that in most cases it is difficult to imagine how such a question could be useful to future visitors.
    – Kirk Woll
    Commented Dec 19, 2014 at 2:01
-2

Use Vagrant or VirtualBox and reproduce the bug in an environment that others can download. Tell now often you see the bug there.

Use a standard VM-image (e.g. Ubuntu 16.04) and show what to install.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .