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-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF 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 5BC601F59D for ; Wed, 3 Aug 2022 07:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1659513552; bh=Fapz1slWwE9CVOY8dwrVpS8vfcDMpKKH9oCmuk9FOLk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=5d/PcRZ3KNaR7O5TlzVfjdECXp/V23dALxtPUegQIsnscu9KnPYVQKq5G3kAIMAtn 0+K+IOqG1ni4ud5ag54tPOxpHdxYcl+Xij+WmI254xrTl9YKKgS24EjwE1N5QIxaCY tHhuJqXrCQN2x+mbFoQCj7sshKr/uer8I3Anl4nc= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/4] www: gzip_filter: gracefully handle socket ->write failures Date: Wed, 3 Aug 2022 07:59:09 +0000 Message-Id: <20220803075912.10219-2-e@80x24.org> In-Reply-To: <20220803075912.10219-1-e@80x24.org> References: <20220803075912.10219-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Socket ->write failures are expected and common for TCP traffic, especially if it's facing unreliable remote connections. So just bail out silently if our {gz} field was already clobbered during the small bit of recursion we hit on ->write failures from async responses. This ought to fix some GzipFilter::zflush errors (via $forward ->close from PublicInbox::HTTP) I've been noticing on deployments running -netd. I'm still unsure as to why I hadn't seen them before, but it might've only been ignorance on my part... Link: https://public-inbox.org/meta/20220802065436.GA13935@dcvr/ --- lib/PublicInbox/GzipFilter.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm index e37f1f76..c586d2f8 100644 --- a/lib/PublicInbox/GzipFilter.pm +++ b/lib/PublicInbox/GzipFilter.pm @@ -149,10 +149,11 @@ sub zflush ($;$) { my $zbuf = delete $self->{zbuf}; my $gz = delete $self->{gz}; my $err; - if (defined $_[1]) { + if (defined $_[1]) { # it's a bug iff $gz is undef w/ $_[1] $err = $gz->deflate($_[1], $zbuf); die "gzip->deflate: $err" if $err != Z_OK; } + $gz // return; # not a bug, recursing on DS->write failure $err = $gz->flush($zbuf); die "gzip->flush: $err" if $err != Z_OK; $zbuf;