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-Status: No, score=-3.9 required=3.0 tests=ALL_TRUSTED,AWL,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 20A1620082 for ; Wed, 3 Feb 2021 08:11:45 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 10/11] lei: use sleep(1) loop for infinite sleep Date: Tue, 2 Feb 2021 22:11:42 -1000 Message-Id: <20210203081143.24424-11-e@80x24.org> In-Reply-To: <20210203081143.24424-1-e@80x24.org> References: <20210203081143.24424-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Perl may internally race and miss signals due to a lack of self-pipe / eventfd / signalfd / EVFILT_SIGNAL usage. While our event loop paths avoid these problems by using signalfd or EVFILT_SIGNAL, thse sleep() calls are not within the event loop. --- lib/PublicInbox/LEI.pm | 2 +- script/lei | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 005f6f7a..28dce0c5 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -299,7 +299,7 @@ sub x_it ($$) { if (my $signum = ($code & 127)) { # usually SIGPIPE (13) $SIG{PIPE} = 'DEFAULT'; # $SIG{$signum} doesn't work kill $signum, $$; - sleep; # wait for signal + sleep(1) while 1; # wait for signal } else { $quit->($code >> 8); } diff --git a/script/lei b/script/lei index 58f0dbe9..40c21ad8 100755 --- a/script/lei +++ b/script/lei @@ -116,7 +116,7 @@ Falling back to (slow) one-shot mode sigchld(); if (my $sig = ($x_it_code & 127)) { kill $sig, $$; - sleep; + sleep(1) while 1; } exit($x_it_code >> 8); } else { # for systems lacking Socket::MsgHdr or Inline::C