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 83BB31F4B4; Sat, 26 Sep 2020 19:55:55 +0000 (UTC) Date: Sat, 26 Sep 2020 19:55:55 +0000 From: Eric Wong To: meta@public-inbox.org Subject: Re: [PATCH] imap: avoid raising exception if client disconnects Message-ID: <20200926195555.GA31457@dcvr> References: <20200926080837.29266-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200926080837.29266-1-e@80x24.org> List-Id: Eric Wong wrote: > diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm > index e7ea7f7f..9327100c 100644 > --- a/lib/PublicInbox/IMAP.pm > +++ b/lib/PublicInbox/IMAP.pm > @@ -619,18 +619,19 @@ sub fetch_run_ops { > sub fetch_blob_cb { # called by git->cat_async via git_async_cat > my ($bref, $oid, $type, $size, $fetch_arg) = @_; > my ($self, undef, $msgs, $range_info, $ops, $partial) = @$fetch_arg; > + my $ibx = $self->{ibx} or return; # client disconnected Encountering some (probably) Gcf2-related errors after this change. PublicInbox::DS::close is idempotent, so maybe this is safer: diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 9327100c..be9c7dca 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -619,7 +619,7 @@ sub fetch_run_ops { sub fetch_blob_cb { # called by git->cat_async via git_async_cat my ($bref, $oid, $type, $size, $fetch_arg) = @_; my ($self, undef, $msgs, $range_info, $ops, $partial) = @$fetch_arg; - my $ibx = $self->{ibx} or return; # client disconnected + my $ibx = $self->{ibx} or return $self->close; # client disconnected my $smsg = shift @$msgs or die 'BUG: no smsg'; if (!defined($oid)) { # it's possible to have TOCTOU if an admin runs