From: Eric Wong <e@80x24.org>
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 [thread overview]
Message-ID: <20220803075912.10219-2-e@80x24.org> (raw)
In-Reply-To: <20220803075912.10219-1-e@80x24.org>
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;
next prev parent reply other threads:[~2022-08-03 7:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-03 7:59 [PATCH 0/4] compression-related stuff Eric Wong
2022-08-03 7:59 ` Eric Wong [this message]
2022-08-03 7:59 ` [PATCH 2/4] www: gzip_filter: update a few comments Eric Wong
2022-08-03 7:59 ` [PATCH 3/4] ds: use ->dflush to distinguish from ->zflush Eric Wong
2022-08-03 7:59 ` [PATCH 4/4] www: simplify GzipFilter->zflush callers Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220803075912.10219-2-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).