]> Sergey Matveev's repositories - public-inbox.git/commitdiff
DS: workaround IO::Kqueue EINTR (mis-)handling
authorEric Wong <e@80x24.org>
Sun, 5 May 2019 04:56:14 +0000 (04:56 +0000)
committerEric Wong <e@80x24.org>
Sun, 5 May 2019 23:23:42 +0000 (23:23 +0000)
IO::Kqueue seems unmaintained, so workaround a long-standing
bug where it falls over on signals:
https://rt.cpan.org/Ticket/Display.html?id=116615

TODO
lib/PublicInbox/DS.pm

diff --git a/TODO b/TODO
index ac255b861ca3e21d6598be1493845b79afbaf812..d947b0ff822198abccc4f1c558eedd42f64bbae5 100644 (file)
--- a/TODO
+++ b/TODO
@@ -52,10 +52,6 @@ all need to be considered for everything we introduce)
 
   cf.  https://public-inbox.org/git/20160814012706.GA18784@starla/
 
-* portability to FreeBSD (and other Free Software *BSDs)
-  ugh... https://rt.cpan.org/Ticket/Display.html?id=116615
-  (IO::KQueue is broken with Danga::Socket / PublicInbox::DS)
-
 * improve documentation
 
 * linkify thread skeletons better
index 7bd5d42b9b2aaef8ab73acd356c4d66b6225d9ea..ea09fc96ed6cc9f38af0d629c2d358d0b3ef8ec1 100644 (file)
@@ -428,7 +428,15 @@ sub KQueueEventLoop {
 
     while (1) {
         my $timeout = RunTimers();
-        my @ret = $KQueue->kevent($timeout);
+        my @ret = eval { $KQueue->kevent($timeout) };
+        if (my $err = $@) {
+            # workaround https://rt.cpan.org/Ticket/Display.html?id=116615
+            if ($err =~ /Interrupted system call/) {
+                @ret = ();
+            } else {
+                die $err;
+            }
+        }
 
         foreach my $kev (@ret) {
             my ($fd, $filter, $flags, $fflags) = @$kev;