]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei/store: check for any unexpected process death
authorEric Wong <e@80x24.org>
Thu, 21 Oct 2021 21:10:21 +0000 (21:10 +0000)
committerEric Wong <e@80x24.org>
Fri, 22 Oct 2021 00:54:37 +0000 (00:54 +0000)
The lei/store process should only exit from EOF on the
socket, so make sure we note any unintended signals

lib/PublicInbox/LeiStore.pm

index 821045701dfe53398ad89ebddeb7853e54a4a299..16e7d302dc2fcdfaa0e6c239f3acb7ff571865a3 100644 (file)
@@ -571,6 +571,12 @@ sub recv_and_run {
        $self->SUPER::recv_and_run(@args);
 }
 
+sub _sto_atexit { # dwaitpid callback
+       my ($args, $pid) = @_;
+       my $self = $args->[0];
+       warn "lei/store PID:$pid died \$?=$?\n" if $?;
+}
+
 sub write_prepare {
        my ($self, $lei) = @_;
        $lei // die 'BUG: $lei not passed';
@@ -587,7 +593,7 @@ sub write_prepare {
                                        -err_wr => $w,
                                        to_close => [ $r ],
                                });
-               $self->wq_wait_async; # outlives $lei
+               $self->wq_wait_async(\&_sto_atexit); # outlives $lei
                require PublicInbox::LeiStoreErr;
                PublicInbox::LeiStoreErr->new($r, $lei);
        }