Re: LWP hangs forever with get

[email protected] (Jesper Persson) Mon, 2 Jun 2014 17:55:46 +0200
Newsgroups perl.libwww
Message-ID <CA+uC3V1tXg+x0M8Ahq8pRsEjZesOAsE+zEm=uTPdT61OTOxf-Q@mail.gmail.com>
--001a11c139c8dcc1df04fadc6e54
Content-Type: text/plain; charset=UTF-8

Hi Steffen,

thank you for taking your time to fix/workaround this.

I have just updated IO::Socket::SSL to version 1.992 and I can verify that
the "hang" no longer happens.

Best Regards
Jesper


On 1 June 2014 23:55, Steffen Ullrich <[email protected]> wrote:

>
>
>> READ:
>>              {
>>                  die "read timeout" unless $self->can_read;
>>                  my $n = $self->sysread($_, 1024, length);
>>                  unless (defined $n) {
>>                      redo READ if $!{EINTR} || $!{EAGAIN};
>>
>
> The server makes a connection reset if you try to access
> https://www.butler.edu/boa/default.aspx. On unix this will set $! to
> ECONNRESET, and for unknown reason this will not set $! on Windows with
> Strawberry perl5.18.2 , but only returns "SSL read error" from the SSL
> layer.
>
> Thus $! will stay at EINTR from the previous error and it will loop
> forever.
>
> IO::Socket::SSL 1.992 (just released) works around this problem by
> resetting $! before doing I/O. This way $! will no longer stay at $!, but
> will be undef and thus the loop will exit, albeit with no specific error.
> The real fix would be of course to set $! to ECONNRESET in the underlying
> IO::Socket layer if the TCP connection was reset.
>
> Steffen
>
>
>

--001a11c139c8dcc1df04fadc6e54
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Steffen,<div><br></div><div>thank you for taking your t=
ime to fix/workaround this.</div><div><br></div><div>I have just updated=C2=
=A0<span style=3D"font-family:arial,sans-serif;font-size:13px">IO::Socket::=
SSL to version 1.992 and I can verify that the &quot;hang&quot; no longer h=
appens.</span></div>

<div><span style=3D"font-family:arial,sans-serif;font-size:13px"><br></span=
></div><div><span style=3D"font-family:arial,sans-serif;font-size:13px">Bes=
t Regards</span></div><div><span style=3D"font-family:arial,sans-serif;font=
-size:13px">Jesper</span></div>

</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On 1 Ju=
ne 2014 23:55, Steffen Ullrich <span dir=3D"ltr">&lt;<a href=3D"mailto:coyo=
[email protected]" target=3D"_blank">[email protected]</a>&gt;</span> wro=
te:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div class=3D""><br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
<br>
READ:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0die &quot;rea=
d timeout&quot; unless $self-&gt;can_read;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0my $n =3D $se=
lf-&gt;sysread($_, 1024, length);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0unless (defin=
ed $n) {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0redo READ if $!{EINTR} || $!{EAGAIN};<br>
</blockquote>
<br></div>
The server makes a connection reset if you try to access <a href=3D"https:/=
/www.butler.edu/boa/default.aspx" target=3D"_blank">https://www.butler.edu/=
boa/<u></u>default.aspx</a>. On unix this will set $! to ECONNRESET, and fo=
r unknown reason this will not set $! on Windows with Strawberry perl5.18.2=
 , but only returns &quot;SSL read error&quot; from the SSL layer.<br>


<br>
Thus $! will stay at EINTR from the previous error and it will loop forever=
.<br>
<br>
IO::Socket::SSL 1.992 (just released) works around this problem by resettin=
g $! before doing I/O. This way $! will no longer stay at $!, but will be u=
ndef and thus the loop will exit, albeit with no specific error. The real f=
ix would be of course to set $! to ECONNRESET in the underlying IO::Socket =
layer if the TCP connection was reset.<span class=3D"HOEnZb"><font color=3D=
"#888888"><br>


<br>
Steffen<br>
<br>
<br>
</font></span></blockquote></div><br></div>

--001a11c139c8dcc1df04fadc6e54--