From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 2/3] git: prefer WNOHANG for `git cat-file --batch-*'
Date: Thu, 30 May 2024 09:45:14 +0000 [thread overview]
Message-ID: <20240530094515.3402089-3-e@80x24.org> (raw)
In-Reply-To: <20240530094515.3402089-1-e@80x24.org>
When inside our DS event loop, ensure we don't stall on
synchronous waitpid when stopping `--batch-*' processes.
Instead of calling PublicInbox::IO::close explicitly, let
refcounting close the socket via PublicInbox::IO::DESTROY and
the SIGCHLD handler will deal with it when the kernel and event
loop get to it.
---
lib/PublicInbox/Git.pm | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index ff38efa1..55005475 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -208,7 +208,7 @@ sub cat_async_retry ($$) {
$oid = \$oid if !@$new_inflight; # to indicate oid retried
push @$new_inflight, $oid, $cb, $arg;
}
- $sock->close if $sock; # only safe once old_inflight is empty
+ undef $sock; # gcf_drain may run from PublicInbox::IO::DESTROY
cat_async_step($self, $new_inflight); # take one step
}
@@ -665,10 +665,9 @@ sub watch_async ($) {
sub close {
my ($self) = @_;
- my $sock = $self->{sock};
delete @$self{qw(-bc err_c inflight)};
delete($self->{epwatch}) ? $self->SUPER::close : delete($self->{sock});
- $sock->close if $sock; # calls gcf_drain via awaitpid
+ # gcf_drain may run from PublicInbox::IO::DESTROY
}
package PublicInbox::GitCheck; # only for git <2.36
next prev parent reply other threads:[~2024-05-30 9:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-30 9:45 [PATCH 0/3] reduce synchronous waitpid calls Eric Wong
2024-05-30 9:45 ` [PATCH 1/3] gcf2: eliminate unnecessary autodie::close import Eric Wong
2024-05-30 9:45 ` Eric Wong [this message]
2024-05-30 9:45 ` [PATCH 3/3] git: reduce spawning for rev-parse --git-path Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240530094515.3402089-3-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).