develooper Front page | perl.perl5.porters | Postings from October 2014

Re: [MSWin32] I need help with RT#98976

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
October 2, 2014 14:13
Subject:
Re: [MSWin32] I need help with RT#98976
Message ID:
20141002151257.268ddf9e@shy.leonerd.org.uk
On Thu, 2 Oct 2014 08:38:20 -0500
"Craig A. Berry" <craig.a.berry@gmail.com> wrote:

> It looks like a race condition in IO::Socket::IP::connect, which calls
> CORE::connect, gets EINPROGRESS, then sets up a select to implement
> the timeout that waits for the connection to complete.  The select
> always times out because the connection completes in between calling
> CORE::connect and select so there is never any activity on the socket
> that would make the select fire.  The following seems to fix it:

I'm not sure I believe that explanation.

I'm select()ing for writability or exceptional status. If as you
suggest, the connect() has already fully succeeded before we enter the
select(), then the socket is now nicely connected and usable, at which
point it definitely is writable, so the select() should yield. If
instead the connect() has now failed, the socket is now in exceptional
status, so again the select() will yield.


Again it should be noted that the bug isn't a timeout bug - the
function quickly returns EBADF - this means that some system call
received a file descriptor number that doesn't even relate to an open
file descriptor at all. I can't see how that situation could arise from
this explanation.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk
http://www.leonerd.org.uk/  |  https://metacpan.org/author/PEVANS

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About