in reply to Re: MozRepl cleanup problem
in thread MozRepl cleanup problem

First of all, thanks for the fast reply.

I tried moving the creation of $firemech outside the loop, but this resulted in making the script hang after changing to the second page. To explain further, it connected to the first page, got everything I asked for, then it connected to the second one (could see it in Firefox), but nothing happened. I waited something like 5 minutes, it didn't even timeout.

Could you explain again what you mean by "maybe you keep other references into Firefox"? I didn't understand what should I break of all the stuff I use for those cycles.

Replies are listed 'Best First'.
Re^3: MozRepl cleanup problem
by Corion (Patriarch) on Oct 30, 2010 at 16:45 UTC

    All the data you pull out of Firefox as HTML elements (through the ->xpath method or the ->selector method, for example), keeps the bridge into Firefox alive. So you need to make sure you don't have any more such objects lying around when you want a clean exit (or you just ignore the warning messages).

    I'm not sure why the script would hang at the second round. Maybe the site does not load some data it loads on the first round. You'll have to debug the behaviour of the site when automating it.

      Sadly, I can't ignore the warnings as when they appear it means the script has abruptly ended itself (before the real end of the cycle).

      As a note, I'm 100% sure that the data I'm looking for is in the page and gets loaded properly since I checked again and since it's one of the pages I usually use to test the script.

      Anyway, I tried cleaning everything I could from the cycle and nothing changed. Still same errors, plus this one occasionally:

      Failed to connect to , command timed-out at /Library/Perl/5.10.0/MozRepl/Client.pm line 186

      I undefined: firemech, content, date, retries, game, longid, shortid, matchid, flag. I know some of these are probably not the cause of my issues, but it was worth a try. I have no idea how to undefine anything about xpath since I didn't copy it anywhere (just checked it was in the page).

      Anything else I have missed or that I might try? Again, thanks for your patience.

        Sadly, I can't ignore the warnings as when they appear it means the script has abruptly ended itself (before the real end of the cycle).

        No. Global destruction happens at the end of your program, not somewhere in the middle. If you fork(), you maybe get that, so don't do that then.

        If you post a complete, self-contained example that reproduces the problem but is not longer than 20 lines, that would help me to help you better. I could then try to reproduce what you're seeing and maybe find what causes it easier.