From f4bb8e4e497785665b1a69c08c2325c5566c24f5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 25 Oct 2023 15:33:49 +0000 Subject: [PATCH] cindex: fix large prunes When comm(1) has a lot of data to output, we must ensure we explicitly close FDs of processes in previous stages of the pipeline to ensure comm(1) to terminates properly. This is difficult to test automatically with small test repos... Fixes: 17b06aa32aac (cindex: start using run_await to simplify code) --- lib/PublicInbox/CodeSearchIdx.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index 80636270b..330806646 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -993,6 +993,7 @@ sub run_prune { # OnDestroy when `git config extensions.objectFormat' are done run_await(\@AWK, $CMD_ENV, $awk_opt, \&cmd_done); run_await([@SORT, '-u'], $CMD_ENV, $sort_opt, \&cmd_done); my $comm_rd = popen_rd(\@COMM, $CMD_ENV, $comm_opt, \&cmd_done, \@COMM); + %$_ = () for ($awk_opt, $sort_opt, $comm_opt); # comm_rd is blocking :< PublicInbox::CidxComm->new($comm_rd, $self); # calls cidx_read_comm my $git_ver = PublicInbox::Git::git_version(); push @PRUNE_BATCH, '--buffer' if $git_ver ge v2.6; -- 2.47.2