http://www.perlmonks.org?node_id=11132755


in reply to Re: Next from inner loop only works "most of the time"
in thread Next from inner loop only works "most of the time"

Thanks for the effort! I'm glad that my problem statement was clear enough for you to generate this code. I should have added that I'm using AS Perl, 64bit, v5.24.

Basically what I have is a UFO report. I do have a picture of the UFO. But in order to convince anybody that this UFO actually exists, I need to be able to make the UFO appear on demand!

I suspect that there is something that varies between runs of Perl. What that is, I don't know. The program is a command line thing using STDIN and STDOUT. So my thinking now is to make a Perl program that itself launches another instance of Perl with my script, "perl wm.pl" (I call my program "word master"). This new test program would take over STDIN and STDOUT and run some test scenario, quit the program and then repeat this process a whole bunch of times looking for the UFO. I believe that I have saved a complete command line session from Perl launch to UFO appearance. I suppose there could be some state dependent thing so I would run all of the commands leading up to the failure.

As I said in the title of my post, the "problem" only happens some of the time! This is not a "hard fail" and as such, I expect there to be some difficulty in making this repeatable. Anyway suggestions about how best to write such a "beat it up" test script would be welcome!

This thing actually works well enough for my purposes "as is". But it has gotten my Perl inquisitiveness tweaked.

  • Comment on Re^2: Next from inner loop only works "most of the time"

Replies are listed 'Best First'.
Re^3: Next from inner loop only works "most of the time"
by hippo (Chancellor) on May 20, 2021 at 09:15 UTC
    Basically what I have is a UFO report. I do have a picture of the UFO. But in order to convince anybody that this UFO actually exists, I need to be able to make the UFO appear on demand!

    Quite so. Intermittent bugs are undoubtedly the worst. If your own code analysis doesn't find it then more often than not the only thing that will help is to log everything and then pore over those logs when the bug manifests.

    As I said in the title of my post, the "problem" only happens some of the time! This is not a "hard fail" and as such, I expect there to be some difficulty in making this repeatable. Anyway suggestions about how best to write such a "beat it up" test script would be welcome!

    I ran my SSCCE script there 1000 times just in case. As expected, there was no output from any of the runs. I think that we can safely say that the code there, in isolation, is not at fault and you will have to look elsewhere for the cause of the bugs. Presumably you are on MSWin32 since you mention ActiveState? I can't really help you with automating large runs of the code in that case, sorry.

    In your shoes I would slowly expand the SSCCE adding more and more of the surrounding code and running it as many times in a loop as you think prudent. Once you can reproduce the bug (at all, not every time) you can then concentrate on the last thing you added to the SSCCE and try to spot what change that has made.

    Good luck with your debugging.


    🦛

      Thank you for taking my "UFO report" seriously!

      I did indeed copy verbatim the results from my command line session into my post. But that is just a picture of a UFO. This is not proof that such a UFO exists.

      My program works well enough for its purpose (to help me solve hard crossword puzzles).
      But this rare failure does tweak my Perl interest.

      I will investigate further and apprise the Monks of my results.