* Cygwin Perl LWP timeout workaround
@ 2001-08-14 12:03 Michael Hoffman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Hoffman @ 2001-08-14 12:03 UTC (permalink / raw)
To: Cygwin, LWP
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?)
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Cygwin Perl LWP timeout workaround
@ 2001-08-26 16:43 Michael Hoffman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Hoffman @ 2001-08-26 16:43 UTC (permalink / raw)
To: cygwin
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Cygwin Perl LWP timeout workaround
@ 2001-08-19 17:46 Neil Lunn
0 siblings, 0 replies; 5+ messages in thread
From: Neil Lunn @ 2001-08-19 17:46 UTC (permalink / raw)
To: 'Michael Hoffman', Cygwin, LWP
>-----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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Cygwin Perl LWP timeout workaround
2001-08-17 8:24 Eric Yablonowitz
@ 2001-08-17 11:30 ` Michael Hoffman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Hoffman @ 2001-08-17 11:30 UTC (permalink / raw)
To: Eric Yablonowitz; +Cc: Cygwin
On Fri, 17 Aug 2001, Eric Yablonowitz wrote:
> Thanks for posting this workaround. It has helped me immeasurably.
> The funny thing is that I experience a very similar timeout problem
> using Net::FTP as well as LWP. Anyone know if these could be
> related?
As I've said before, this problem is very hard to diagnose because I
haven't found any way to reproduce it reliably. If anyone else has,
please let me know.
But here's what I've found:
IO::Socket::connect() makes IO non-blocking if there is a timeout
value given.
$blocking = $sock->blocking(0) if $timeout;
Shouldn't a timeout value mean that IO should be blocking? Can someone
please answer this even if they don't have anything else to add?
If so, then this seems consistent with intermittent failures, i.e., if
non-blocking IO is used and the response doesn't come in RIGHT AWAY, a
timeout result is returned?
However, Solaris's IO::Socket::connect() seems to do the same thing
and I haven't heard of problems with it, although I haven't done
extensive usage to get this bug to arise.
--
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: Cygwin Perl LWP timeout workaround
@ 2001-08-17 8:24 Eric Yablonowitz
2001-08-17 11:30 ` Michael Hoffman
0 siblings, 1 reply; 5+ messages in thread
From: Eric Yablonowitz @ 2001-08-17 8:24 UTC (permalink / raw)
To: 'cygwin@cygwin.com', 'Michael Hoffman'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 965 bytes --]
Michael,
Thanks for posting this workaround. Â
It has helped me immeasurably. Â
The funny thing is that I experience a very similar timeout problem using
Net::FTP as well as LWP. Â Anyone know if these could be related?
Thanks!
Â
Eric Yablonowitz
Internet Operations Manager
Ask Jeeves UK
eric@askjeeves.co.uk
Â
Â
Â
Â
Â
Â
Â
Â
This e-mail is confidential and intended solely for the use of the individual to whom it is addressed.
Any views or opinions presented are solely those of the author and do not necessarily represent
those of Ask Jeeves UK or any of its sister companies. If you are not the intended recipient, be advised
that you have received this e-mail in error and that any use, dissemination, forwarding, printing, or copying
of this e-mail is strictly prohibited.
If you have received this e-mail in error please notify the sender. postmaster@ask.co.uk +44 (0) 20 7242 3333)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-08-26 16:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-14 12:03 Cygwin Perl LWP timeout workaround Michael Hoffman
2001-08-17 8:24 Eric Yablonowitz
2001-08-17 11:30 ` Michael Hoffman
2001-08-19 17:46 Neil Lunn
2001-08-26 16:43 Michael Hoffman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).