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


>-----Original Message-----
>From: Michael Hoffman [mailto:hoffmanm@cshl.org]
>Sent: Wednesday, August 15, 2001 4:59 AM
>To: Cygwin; LWP
>Subject: Cygwin Perl LWP timeout workaround
>
>
>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?"

Now further on the patch you propose to LWP by misusing the IO::Socket::INET
connection. This is extremely bizarre when you question a default behaivour
of the IO::Socket::INET connection where a timeout parameter is supplied.

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.

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".

--Neil


>
>I'd work on this more, but I unfortunately can't 
>
>One workaround is to change
>/usr/lib/perl5/site_perl/5.6.1/LWP/Protocol/http.pm to stop passing
>Timeout values. I got the idea from an earlier post on the cygwin
>mailing list regarding Net::SMTP and Net::POP3:
>
>http://sources.redhat.com/ml/cygwin/2001-05/msg00411.html
>
>My cygcheck and perl -V are at the bottom of this message:
>
>http://sources.redhat.com/ml/cygwin/2001-08/msg00028.html
>
>And here's a one-character patch:
>
>--- http.pm.bak Tue Aug 14 14:25:44 2001
>+++ http.pm     Tue Aug 14 14:37:58 2001
>@@ -28,7 +28,7 @@
>     my $sock = IO::Socket::INET->new(PeerAddr => $host,
>                                     PeerPort => $port,
>                                     Proto    => 'tcp',
>-                                    Timeout  => $timeout,
>+#                                   Timeout  => $timeout,
>                                     $self->_extra_sock_opts($host,
>				     $port),
>                                    );
>     unless ($sock) {
>--
>Michael Hoffman <hoffmanm@cshl.org>
>Cold Spring Harbor Laboratory
>
>
>
>
>--
>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/
>

__________________________________________________________________________
Please Note :
Only  the intended recipient is authorised to access or use this e-mail.
If you are not the intended recipient, please delete this e-mail and notify
the sender immediately. The contents of this e-mail are the writer's 
opinion and are not necessarily endorsed by the Gunz Companies
unless expressly stated.

We use virus scanning software but exclude all liability for viruses or
similar in any attachment.



--
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]