From: Eric Wong Date: Tue, 14 Sep 2021 02:39:02 +0000 (+0000) Subject: lei: sto_done_request: add eval guard X-Git-Tag: v1.7.0~384 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=98f847cf7cab205b5d2dbf9e58d86af2a1c190e5;p=public-inbox.git lei: sto_done_request: add eval guard 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. --- 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