Re: Parallel UserAgent..
Marc Langheinrich (marclang@cs.washington.edu)
Thu, 10 Jun 1999 10:17:33 +0900
On Tue, Jun 08, 1999 at 01:38:18PM -0400, Hyun-ju Seo wrote:
> I checked why a job is hangin sometimes.
> (2 OR 3 days).
>
> Sometimes a socket is not closed.
> So, it is reading continuosly like the following.
> read(7, 0x0048D808, 4096) (sleeping...)
This might be a problem of your particular setup (as Gisle pointed out). If
the same thing happens when you use standard LWP (i.e. not the parallel
version) then it's most likely some problem with the OS, perl, or the
underlying IO library (or a combination of the three). If it only happens
when using the Parallel version, then its most certainly some bug in
parallel-user-agent.
> I have a question about that.
> If I give the timeout = 20,
> does it mean 20 sec after a connection or before a connection ?
20 seconds of inactivity on the line. I.e. if the user agent does not get
ANY response from ANY site that it's currently connecting to for more than
20 seconds, it will time out. As soon as even only a single byte comes in,
this time is reset and it will wait another 20 seconds at most for the next
byte(s) to come in.
> Does the program correctly close every socket ?
Well, in "Paralle::UserAgent::wait()" it issues an explicit
close ($socket);
as well as an implicit one afterwards
$socket = undef; # close socket
which should, according to the perl man pages, close the socket. However,
as I understand the socket stuff, the socket will end up sending some sort
of "closing socket" packet to the site it's connected to and then wait for
some form of acknowledgement before actually closing. So even though you
close the socket on your site it might actually take some time for the OS
to physically close it.
PS: I had at one point something like this in there as well:
$socket->shutdown(2); # see "man perlfunc" & "man 2 shutdown"
but somehow this didn't seem to work so I commented it out (can't
remember exactly why, though). Maybe using this instead of (or in
addition to) the above stuff would work better for you?
Marc
--
Marc Langheinrich
marclang@cs.washington.edu