Hello monks, I've been using LWP::Parallel::UserAgent for quite some time now for an academic webminer. But I'm having a problem I just can not get around. After the application has been running for some time, all the open sockets will fail with a (timeout). I'm not sure what is going on or how to correct for it. But my application works by implementing a callback for on_return and then parsing the HTML and registering any new URLs that might be of interest. I have my own DNS caching server, and I only pull one file per domain ever > 5 minutes. Here is my constructor:
my $ua = Spider::LWP->new($depth,$path,$max_sockets,$ignore,$exclude); $ua->duplicates(0);#don't ignore duplicates here as this is done in th +e subclass a gazillion times more efficiently $ua->cookie_jar({});#where else would you store cookies? $ua->redirect(1);#follow redirects. HACKED BASE LIBRARY to make this +work with the subclass. $ua->in_order(1);#do the urls in order, as we randomize their entry in +to the queue. $ua->remember_failures(0);#don't remember failures here as the lib sto +res the entire object. This is done in the subclass $ua->max_hosts($max_sockets);#max open requests at any given moment $ua->max_req(1);#max requests per host $ua->nonblock(1);#don't block on LWP::UserAgent socket reads
Then register the beginning URLs:
$ua->wait(300); # block until we are all finished or until everything + has stopped for 5 minutes
Can anyone see anything wrong with this? What I think is happening is, and maybe I'm way off course here, but that for some reason a socket gets BLOCKED and times out and this timeout causes all the other sockets to timeout.

In reply to LWP::Parallel::UserAgent timeouts by perlmonkey2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.