Skip Menu |

This queue is for tickets about the IO-Async-SSL CPAN distribution.

Report information
The Basics
Id: 102403
Status: resolved
Priority: 0/
Queue: IO-Async-SSL

People
Owner: Nobody in particular
Requestors: DAKKAR [...] cpan.org
Cc: TEAM [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.14
Fixed in: 0.15



CC: TEAM [...] cpan.org
Subject: IO::Async::Listener shouldn't consider EAGAIN as a success
I wrote this: http://paste.scsys.co.uk/468224 When I connect to it, one child process responds, the others call on_ssl_error with "not a socket". Tom diagnosed that the other children get EAGAIN on their 'accept' call, and proposed this patch: http://paste.scsys.co.uk/468228 It looks like only the second hunk is needed: when getting EAGAIN or EWOULDBLOCK, consider it a failure (we didn't get a socket, after all).
That paste has expired :( If anyone still has it to hand could they attach it to the bug? -- Paul Evans
On Fri Mar 13 13:11:47 2015, PEVANS wrote: Show quoted text
> That paste has expired :( > > If anyone still has it to hand could they attach it to the bug?
Yeah, sorry about that. The attached patch should be identical to the expired one. I applied it to my installation just as Tom typed it.
Subject: listener-team.patch
--- lib/IO/Async/Listener.pm 2015-02-15 14:43:51.000000000 +0000 +++ /home/dakkar/.perlbrew/libs/perl-5.20.1@nap/lib/perl5/IO/Async/Listener.pm 2015-02-27 16:58:03.191958253 +0000 @@ -295,7 +295,8 @@ $on_done->( $self, $result ); })->on_fail( sub { my ( $message, undef, $socket, $dollarbang ) = @_; - $self->maybe_invoke_event( on_accept_error => $socket, $dollarbang ); + $self->maybe_invoke_event( on_accept_error => $socket, $dollarbang ) + #unless ($dollarbang||0) == EAGAIN or ($dollarbang||0) == EWOULDBLOCK; }); # Caller is not going to keep hold of the Future, so we have to ensure it @@ -321,7 +322,7 @@ } } elsif( $! == EAGAIN or $! == EWOULDBLOCK ) { - return Future->new->done; + return Future->new->fail( "Missed it", accept => $listen_sock, $! ); } else { return Future->new->fail( "Cannot accept() - $!", accept => $listen_sock, $! );
On Fri Feb 27 12:01:51 2015, DAKKAR wrote: Show quoted text
> I wrote this: http://paste.scsys.co.uk/468224 > > When I connect to it, one child process responds, the others call > on_ssl_error with "not a socket". Tom diagnosed that the other > children get EAGAIN on their 'accept' call, and proposed this patch: > http://paste.scsys.co.uk/468228 > > It looks like only the second hunk is needed: when getting EAGAIN or > EWOULDBLOCK, consider it a failure (we didn't get a socket, after > all).
Ah. Looking again at this I think the problem is in fact in IO::Async::SSL, whose accept-wrapper code fails to take account of the fact that done with an empty result means EAGAIN; it's hard otherwise to account for the non-success but non-failure of EAGAIN-like errors. -- Paul Evans
Patched -- Paul Evans
Subject: rt102403.patch
=== modified file 'lib/IO/Async/SSL.pm' --- lib/IO/Async/SSL.pm 2015-04-04 13:31:09 +0000 +++ lib/IO/Async/SSL.pm 2015-04-04 13:36:04 +0000 @@ -440,6 +440,8 @@ $listener->$cleartext_acceptor( $listen_sock )->then( sub { my ( $socket ) = @_; + return Future->done() unless $socket; # EAGAIN + $stream->configure( handle => $socket ) if $stream; $loop->SSL_upgrade(