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,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 6FCAF1F934 for ; Tue, 14 Sep 2021 02:39:05 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/5] lei: sto_done_request: add eval guard Date: Tue, 14 Sep 2021 02:39:02 +0000 Message-Id: <20210914023905.21410-3-e@80x24.org> In-Reply-To: <20210914023905.21410-1-e@80x24.org> References: <20210914023905.21410-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Failures here can cause the lei-daemon event loop to break since PktOp doesn't guard dispatch. Add a guard here (and not deeper in the stack) so we can use the $lei object to report errors. --- lib/PublicInbox/LEI.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index f0caac03..e529c86a 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -1500,12 +1500,15 @@ sub lms { # read-only LeiMailSync sub sto_done_request { # only call this from lei-daemon process (not workers) my ($lei, $sock) = @_; - if ($sock //= $lei->{sock}) { - $LIVE_SOCK{"$sock"} = $sock; - $lei->{sto}->ipc_do('done', "$sock"); # issue, async wait - } else { # forcibly wait - my $wait = $lei->{sto}->ipc_do('done'); - } + eval { + if ($sock //= $lei->{sock}) { # issue, async wait + $LIVE_SOCK{"$sock"} = $sock; + $lei->{sto}->ipc_do('done', "$sock"); + } else { # forcibly wait + my $wait = $lei->{sto}->ipc_do('done'); + } + }; + $lei->err($@) if $@; } sub sto_done_complete { # called in lei-daemon when LeiStore->done is complete