bug in AnyEvent perl backend

Bas Denissen b.denissen at triple-it.nl
Wed Mar 17 15:47:33 CET 2010


Hello all,

The AnyEvent perl implementation seems to handle an interrupted 'select' 
call incorrectly. When a signal arrives during the 'select', the EINTR 
error isn't handled but instead the read/write-watchers are executed 
because the corresponding bits are (still) set.

I've attached a small test program to demonstrate the problem. Just 
start it and press ctrl-c, it will show you it is in the read-callback.

When using either the Event or EV implementation, the signal 
interruption is detected and the poll/select is restarted.

Quick fix, but i'm not sure how it impacts the 'windows workaround' 
stuff. The 'patch':

=======================================================
--- Perl.pm.old	2010-03-17 15:45:12.000000000 +0100
+++ Perl.pm	2010-03-17 15:45:24.000000000 +0100
@@ -216,7 +216,7 @@

        _update_clock;

-      if ($fds) {
+      if ($fds > 0) {
           # buggy microshit windows errornously sets exceptfds instead 
of writefds
           $vec[1] |= $vec[2] if AnyEvent::WIN32;
=======================================================

Kind regards,

  Bas Denissen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aeaccept.pl
Type: application/x-perl
Size: 470 bytes
Desc: not available
URL: <http://lists.schmorp.de/pipermail/anyevent/attachments/20100317/f3c9d802/attachment.bin>


More information about the anyevent mailing list