about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-05-05 04:56:14 +0000
committerEric Wong <e@80x24.org>2019-05-05 23:23:42 +0000
commite229e045a93ef35c335af00cd0e130a6ec6146d4 (patch)
tree663aef2ab7ddbbd507b8b1b750134954bdaa920d
parent0ec366eb837dc8ee3face1d2a5a40669d937054e (diff)
downloadpublic-inbox-e229e045a93ef35c335af00cd0e130a6ec6146d4.tar.gz
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
-rw-r--r--TODO4
-rw-r--r--lib/PublicInbox/DS.pm10
2 files changed, 9 insertions, 5 deletions
diff --git a/TODO b/TODO
index ac255b86..d947b0ff 100644
--- 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
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm
index 7bd5d42b..ea09fc96 100644
--- a/lib/PublicInbox/DS.pm
+++ b/lib/PublicInbox/DS.pm
@@ -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;