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

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

Thread Previous | Thread Next
Paul "LeoNerd" Evans
October 2, 2014 14:13
Re: [MSWin32] I need help with RT#98976
Message ID:
On Thu, 2 Oct 2014 08:38:20 -0500
"Craig A. Berry" <> 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  |

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About