From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id C5FB31F45F; Sun, 5 May 2019 04:56:14 +0000 (UTC) Date: Sun, 5 May 2019 04:56:14 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/4] DS: workaround IO::Kqueue EINTR (mis-)handling Message-ID: <20190505045614.GA7031@ailurophile> References: <20190505005219.31772-1-e@80x24.org> <20190505005219.31772-2-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190505005219.31772-2-e@80x24.org> List-Id: 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 ac255b8..d947b0f 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 7bd5d42..ea09fc9 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; --