From e229e045a93ef35c335af00cd0e130a6ec6146d4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 5 May 2019 04:56:14 +0000 Subject: DS: workaround IO::Kqueue EINTR (mis-)handling 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 | 4 ---- lib/PublicInbox/DS.pm | 10 +++++++++- 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; -- cgit v1.2.3-24-ge0c7