]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
cindex: fix large prunes
authorEric Wong <e@80x24.org>
Wed, 25 Oct 2023 15:33:49 +0000 (15:33 +0000)
committerEric Wong <e@80x24.org>
Wed, 25 Oct 2023 20:32:03 +0000 (20:32 +0000)
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

index 80636270b81f89d1a8d75d3759f538f191f5e44f..330806646405a9780d5b8591e495396841fea0df 100644 (file)
@@ -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;