diff options
author | Eric Wong <e@80x24.org> | 2023-05-01 23:29:35 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-05-02 13:06:36 +0000 |
commit | 9f2dfa6dbec4b5e162a9f4812351f567bbc331ee (patch) | |
tree | 85a19de2e117818798de3ec4d97453c46d37a381 /lib/PublicInbox/IMAP.pm | |
parent | 0de8537965927d200a36363d8f776e4ca5036ed8 (diff) | |
download | public-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/IMAP.pm')
-rw-r--r-- | lib/PublicInbox/IMAP.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 37317948..00f99ef7 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -592,14 +592,16 @@ sub fetch_blob_cb { # called by git->cat_async via ibx_async_cat my ($self, undef, $msgs, $range_info, $ops, $partial) = @$fetch_arg; my $ibx = $self->{ibx} or return $self->close; # client disconnected my $smsg = shift @$msgs or die 'BUG: no smsg'; - if (!defined($oid)) { + if (!defined($type)) { + warn "E: git aborted on $oid / $smsg->{blob} $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 $ibx->{inboxdir}\n"; + warn "E: $smsg->{blob} $type in $ibx->{inboxdir}\n"; return $self->requeue_once; - } else { - $smsg->{blob} eq $oid or die "BUG: $smsg->{blob} != $oid"; } + $smsg->{blob} eq $oid or die "BUG: $smsg->{blob} != $oid"; my $pre; ($self->{anon} && !$self->{wbuf} && $msgs->[0]) and $pre = ibx_async_prefetch($ibx, $msgs->[0]->{blob}, |