diff options
author | Eric Wong <e@80x24.org> | 2023-11-26 02:11:04 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-26 19:34:57 +0000 |
commit | 51b2fa7fb2b7b1caed8b1dde4613992a192225ed (patch) | |
tree | 2ca5f2161edc525a895223837e4455d4d9ed7646 /lib/PublicInbox/Gcf2Client.pm | |
parent | e7f0919b6ec2e959444efb12af44658aa1ea9fb4 (diff) | |
download | public-inbox-51b2fa7fb2b7b1caed8b1dde4613992a192225ed.tar.gz |
While the {inflight} array should be tied to the IO object even more tightly, that's not an easy task with our current code. So take some small steps by introducing a gcf_inflight helper to validate the ownership of the process and to drain the inflight array via the awaitpid callback. This hopefully fix problems with t/lei-q-save.t (still) hanging occasionally on v2 outputs since git->cleanup/->DESTROY was getting called in v2 shard workers.
Diffstat (limited to 'lib/PublicInbox/Gcf2Client.pm')
-rw-r--r-- | lib/PublicInbox/Gcf2Client.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/PublicInbox/Gcf2Client.pm b/lib/PublicInbox/Gcf2Client.pm index 19d77e32..07ff7dcb 100644 --- a/lib/PublicInbox/Gcf2Client.pm +++ b/lib/PublicInbox/Gcf2Client.pm @@ -31,15 +31,16 @@ sub new { $opt->{0} = $opt->{1} = $s2; my $cmd = [$^X, $^W ? ('-w') : (), qw[-MPublicInbox::Gcf2 -e PublicInbox::Gcf2::loop]]; - PublicInbox::IO::attach_pid($s1, spawn($cmd, $env, $opt)); $self->{inflight} = []; + PublicInbox::IO::attach_pid($s1, spawn($cmd, $env, $opt), + \&PublicInbox::Git::gcf_drain, $self->{inflight}); $self->{epwatch} = \undef; # for Git->cleanup $self->SUPER::new($s1, EPOLLIN); } sub gcf2_async ($$$;$) { my ($self, $req, $cb, $arg) = @_; - my $inflight = $self->{inflight} or return $self->close; + my $inflight = $self->gcf_inflight or return; PublicInbox::Git::write_all($self, $req, \&cat_async_step, $inflight); push @$inflight, \$req, $cb, $arg; # ref prevents Git.pm retries } @@ -49,6 +50,7 @@ sub alternates_changed {} no warnings 'once'; +*gcf_inflight = \&PublicInbox::Git::gcf_inflight; # for event_step *cat_async_step = \&PublicInbox::Git::cat_async_step; # for event_step *event_step = \&PublicInbox::Git::event_step; *fail = \&PublicInbox::Git::fail; |