From 9f2dfa6dbec4b5e162a9f4812351f567bbc331ee Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 1 May 2023 23:29:35 +0000 Subject: daemon: improve handling of Git->async_abort The $oid arg for Git->cat_async is defined on async_abort using the original request, so use undefined $type to distinguish that case in caller-supplied callbacks. async_abort isn't common, of course, but sometimes git subprocesses can die unexpectedly. --- lib/PublicInbox/NNTP.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/NNTP.pm') diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 7a91e7eb..316b7775 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -537,7 +537,11 @@ sub blob_cb { # called by git->cat_async via ibx_async_cat my ($bref, $oid, $type, $size, $smsg) = @_; my $self = $smsg->{nntp}; my $code = $smsg->{nntp_code}; - if (!defined($oid)) { + if (!defined($type)) { + warn "E: git aborted on $oid / $smsg->{blob} ". + $self->{-ibx}->{inboxdir}; + return $self->close; + } elsif ($type ne 'blob') { # it's possible to have TOCTOU if an admin runs # public-inbox-(edit|purge), just move onto the next message warn "E: $smsg->{blob} missing in $smsg->{-ibx}->{inboxdir}\n"; -- cgit v1.2.3-24-ge0c7