about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-05-01 23:29:35 +0000
committerEric Wong <e@80x24.org>2023-05-02 13:06:36 +0000
commit9f2dfa6dbec4b5e162a9f4812351f567bbc331ee (patch)
tree85a19de2e117818798de3ec4d97453c46d37a381 /lib/PublicInbox/NNTP.pm
parent0de8537965927d200a36363d8f776e4ca5036ed8 (diff)
downloadpublic-inbox-9f2dfa6dbec4b5e162a9f4812351f567bbc331ee.tar.gz
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.
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm6
1 files changed, 5 insertions, 1 deletions
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";