Skip Menu |

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

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

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

Bug Information
Severity: (no value)
Broken in: 0.65
Fixed in: 0.66



In IO::Async 0.64 this worked fine. In IO::Async 0.65, the CPU thrashes indefinitely, looping apparently because of IO::Async::Loop::Poll; If you change the loop to Select or Epoll, it behaves fine. #!/usr/bin/env perl use strict; use warnings; use IO::Async::Loop; use Net::Async::HTTP; my $loop = IO::Async::Loop->new; my $http = Net::Async::HTTP->new; $loop->add($http); $http->do_request( request => HTTP::Request->new(GET => 'http://google.com'), on_response => sub { warn "RESP\n"; }, on_error => sub { warn "ERROR\n"; }, ); # Let's go! $loop->run; -- Matthew Horsfall (alh)
On Fri Apr 10 13:44:51 2015, WOLFSAGE wrote: Show quoted text
> In IO::Async 0.65, the CPU thrashes indefinitely, looping apparently > because of IO::Async::Loop::Poll;
"oops". Patch attached. -- Paul Evans
Subject: rt103445.patch
=== modified file 'lib/IO/Async/Loop/Poll.pm' --- lib/IO/Async/Loop/Poll.pm 2015-02-15 14:43:30 +0000 +++ lib/IO/Async/Loop/Poll.pm 2015-04-17 15:14:17 +0000 @@ -303,12 +303,14 @@ $self->__unwatch_io( %params ); - # Guard for global destruction - my $poll = $self->{poll} or return; + my $poll = $self->{poll}; my $handle = $params{handle}; + my $fileno = $handle->fileno; - my $curmask = $poll->mask( $handle ) || 0; + my $curmask = $poll ? $poll->mask( $handle ) + : $self->{pollmask}{$fileno}; + $curmask ||= 0; my $mask = $curmask; $params{on_read_ready} and $mask &= ~POLLIN; @@ -324,7 +326,10 @@ } } - $poll->mask( $handle, $mask ) if $mask != $curmask; + return if $mask == $curmask; + + $poll ? $poll->mask( $handle, $mask ) + : ( $self->{pollmask}{$fileno} = $mask ); } =head1 AUTHOR
Released in 0.66 -- Paul Evans