lib/PublicInbox/IPC.pm | 10 +++++----- lib/PublicInbox/LEI.pm | 2 +- lib/PublicInbox/LeiXSearch.pm | 4 ++-- diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm index 37f029446ad75d13ee58257e84f76f9968874c1c..689f32d0dc690a74058414d419f56b23d86c9f29 100644 --- a/lib/PublicInbox/IPC.pm +++ b/lib/PublicInbox/IPC.pm @@ -137,7 +137,7 @@ $self->{-ipc_pid} = $pid; } sub ipc_worker_reap { # dwaitpid callback - my ($self, $pid) = @_; + my ($args, $pid) = @_; return if !$?; # TERM(15) is our default exit signal, PIPE(13) is likely w/ pager my $s = $? & 127; @@ -145,9 +145,9 @@ warn "PID:$pid died with \$?=$?\n" if $s != 15 && $s != 13; } sub wq_wait_old { - my ($self) = @_; + my ($self, $args) = @_; my $pids = delete $self->{"-wq_old_pids.$$"} or return; - dwaitpid($_, \&ipc_worker_reap, $self) for @$pids; + dwaitpid($_, \&ipc_worker_reap, [$self, $args]) for @$pids; } # for base class, override in sub classes @@ -164,7 +164,7 @@ } # idempotent, can be called regardless of whether worker is active or not sub ipc_worker_stop { - my ($self) = @_; + my ($self, $args) = @_; my ($pid, $ppid) = delete(@$self{qw(-ipc_pid -ipc_ppid)}); my ($w_req, $r_res) = delete(@$self{qw(-ipc_req -ipc_res)}); if (!$w_req && !$r_res) { @@ -175,7 +175,7 @@ die 'no PID with IPC pipes' unless $pid; $w_req = $r_res = undef; return if $$ != $ppid; - dwaitpid($pid, \&ipc_worker_reap, $self); + dwaitpid($pid, \&ipc_worker_reap, [$self, $args]); } # use this if we have multiple readers reading curl or "pigz -dc" diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index c0b904513a0e7bc8a814bbbbeab3af79aeed58f4..4f7ed17109ae3f72b21b49f5a97ccb1c730c2ddf 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -860,7 +860,7 @@ my $wq = delete $self->{$f} or next; if ($wq->wq_kill) { $wq->wq_close } elsif ($wq->wq_kill_old) { - $wq->wq_wait_old; + $wq->wq_wait_old($self); } } close(delete $self->{1}) if $self->{1}; # may reap_compress diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm index de82a7daee1d4b5a20227e3f4819bc69d330cacb..b4a9b89dc169f9f9f2a0f132cfb8b32c91c8ef52 100644 --- a/lib/PublicInbox/LeiXSearch.pm +++ b/lib/PublicInbox/LeiXSearch.pm @@ -283,7 +283,7 @@ my ($lei) = @_; my $has_l2m = exists $lei->{l2m}; for my $f (qw(lxs l2m)) { my $wq = delete $lei->{$f} or next; - $wq->wq_wait_old; + $wq->wq_wait_old($lei); } $lei->{ovv}->ovv_end($lei); if ($has_l2m) { # close() calls LeiToMail reap_compress @@ -359,7 +359,7 @@ sub sigpipe_handler { # handles SIGPIPE from l2m/lxs workers my ($lei) = @_; my $lxs = delete $lei->{lxs}; if ($lxs && $lxs->wq_kill_old) { # is this the daemon? - $lxs->wq_wait_old; + $lxs->wq_wait_old($lei); } close(delete $lei->{1}) if $lei->{1}; $lei->x_it(13);