]> Sergey Matveev's repositories - public-inbox.git/commitdiff
solvergit: don't drop update-index stdin with qspawn
authorEric Wong <e@80x24.org>
Thu, 12 Sep 2019 06:54:28 +0000 (06:54 +0000)
committerEric Wong <e@80x24.org>
Thu, 12 Sep 2019 06:56:04 +0000 (06:56 +0000)
It's possible for Qspawn callers to be deferred, in which case
we must ensure we don't cause the temporary file used for
stdin to become unref-ed and closed.

This can be a problem when we exceed the default Qspawn
limiter of 32 concurrent processes for "git update-index".

lib/PublicInbox/SolverGit.pm

index 58869ffb3677c66432dbcebe9a7ea6684db9dc07..49f948958cd45a0bdcf1a9de20114f2cad7b5bd1 100644 (file)
@@ -241,7 +241,7 @@ sub prepare_index ($) {
        sysseek($in, 0, 0) or die "seek: $!";
 
        dbg($self, 'preparing index');
-       my $rdr = { 0 => fileno($in) };
+       my $rdr = { 0 => fileno($in), -hold => $in };
        my $cmd = [ qw(git update-index -z --index-info) ];
        my $qsp = PublicInbox::Qspawn->new($cmd, $self->{git_env}, $rdr);
        $qsp->psgi_qx($self->{psgi_env}, undef, sub {