From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id F252F1F5B7 for ; Sun, 5 Jul 2020 23:28:15 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 42/43] daemon: warn on missing blobs Date: Sun, 5 Jul 2020 23:27:58 +0000 Message-Id: <20200705232759.3161-43-e@yhbt.net> In-Reply-To: <20200705232759.3161-1-e@yhbt.net> References: <20200705232759.3161-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Since -edit and -purge should be rare and TOCTOU around them rarer still; missing {blobs} could be indicative of a real bug elsewhere. Warn on them. And I somehow ended up with 3 different field names for Inbox objects. Perhaps they'll be made consistent in the future. --- lib/PublicInbox/GzipFilter.pm | 1 + lib/PublicInbox/IMAP.pm | 1 + lib/PublicInbox/NNTP.pm | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm index 57344604b..b5ad9eb88 100644 --- a/lib/PublicInbox/GzipFilter.pm +++ b/lib/PublicInbox/GzipFilter.pm @@ -170,6 +170,7 @@ sub async_blob_cb { # git->cat_async callback if (!defined($oid)) { # 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 $self->{-inbox}->{inboxdir}\n"; return $http->next_step($self->{async_next}); } $smsg->{blob} eq $oid or bail($self, "BUG: $smsg->{blob} != $oid"); diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index e06021438..d8c898f4b 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -620,6 +620,7 @@ sub fetch_blob_cb { # called by git->cat_async via git_async_cat if (!defined($oid)) { # 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 $self->{ibx}->{inboxdir}\n"; return requeue_once($self); } else { $smsg->{blob} eq $oid or die "BUG: $smsg->{blob} != $oid"; diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 9d91544ab..87ddf7a4a 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -523,6 +523,7 @@ sub blob_cb { # called by git->cat_async via git_async_cat if (!defined($oid)) { # 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 $self->{ng}->{inboxdir}\n"; return $self->requeue; } elsif ($smsg->{blob} ne $oid) { $self->close;