This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Cygwin Perl LWP timeout workaround


Quoting Neil Lunn <neillunn@gunz.com.au>:

> >-----Original Message-----
> >From: Michael Hoffman [mailto:hoffmanm@cshl.org]
> >
> >I seem to get intermittent socket timeout problems with perl's LWP
> >(libwww-perl). I unfortunately cannot reproduce the problem reliably,
> >so debugging it is almost impossible. Even if I supply a large
> timeout
> >value (300 s), LWP sometimes returns a timeout immediately.
> >
> >In /usr/lib/perl5/5.6.1/cygwin/IO/Socket.pm, the connect subroutine
> >sets $sock->blocking(0) if there is a timeout value. (Shouldn't a
> >timeout value turn blocking on?)
>
> For starters this is IO::Socket. What does that have to do with the code
> in
> LWP?
> Secondly this is a *.pm file and the code is in perl. What does this
> have to
> do with a platform (ie cygwin)?
>
> Yes I realise the dependancies in LWP and so would most people so "Why
> write
> this?"

First, the IO::Socket module is in the cygwin directory
underneath /usr/lib/perl5/5.6.1. It is a platform-specific module.

> Looking at the dependancy paths you can complain about IO::Socket,
> IO::Handle modules if you want but I see little point in complaining
> about LWP or Cygwin.

I don't think it's a bug in LWP, since this bug also occurs in
Net::SMTP and Net::POP3 under Cygwin. And I haven't heard of it
occuring under any platform.  I am providing a workaround for a
problem, which at first glance appears to be with LWP, and is actually
probably somewhere else. When I experienced this problem, I thought to
search the mailing list for LWP to see if anyone else had experienced
it (finding nothing useful), and not IO::Socket until I had delved
deep into the code already.

I never "complained" about Cygwin or LWP. I identified a problem and a
possible solution.

> The IO::Handle documentation clearly says that $obj->blocking(0) is
> non-blocking IO
> IO::Socket clearly has the line $obj->blocking(0) if $timeout
>
> I would suggest that in all cases the Authors know exactly what they
> mean.
> If you disagree take it up with them. But I would generally say that
> when
> you don't maintain a piece of code it is not very good community spirit
> to
> go out and say "The Author is wrong and I'm right, so everybody change
> their
> code". The Timeout option is there for a reason, it's an option. You
> don't
> tell everybody "You no longer have an option".

A one character change to that LWP module will save changes to any of
your scripts and modules that use LWP. This isn't the "correct" way to
do things, but I expect you will exemplify "good community spirit" for
providing us with a patch to wherever the problem really is, instead
of criticizing me for suggesting a workaround.

This workaround is just that--a workaround. I'm not suggesting that
the source or distribution be changed, since the underlying bug
appears to be somewhere else, so I apologize if I created confusion by
using the word "patch" once for this kludge. Two people have publicly
thanked me for this (see links below), so it's obviously helping
someone. If you don't like it, you don't have to use it.

http://sources.redhat.com/ml/cygwin/2001-08/msg00777.html
http://archive.develooper.com/libwww@perl.org/msg02862.html
--
Michael Hoffman <grouse@mail.utexas.edu>
The University of Texas at Austin


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]