From 08b96c8dc9aa8cfd67a62fcfc3541bed14fce6bc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 21 Oct 2021 21:10:21 +0000 Subject: [PATCH] lei/store: check for any unexpected process death The lei/store process should only exit from EOF on the socket, so make sure we note any unintended signals --- lib/PublicInbox/LeiStore.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/LeiStore.pm b/lib/PublicInbox/LeiStore.pm index 82104570..16e7d302 100644 --- a/lib/PublicInbox/LeiStore.pm +++ b/lib/PublicInbox/LeiStore.pm @@ -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); } -- 2.44.0