From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [MAYBE] kill rpipe early
Date: Tue, 17 Sep 2019 09:19:15 +0000 [thread overview]
Message-ID: <20190917091915.o5nylhjzk2g7rwax@dcvr> (raw)
In-Reply-To: <20190917083123.6468-1-e@80x24.org>
Eric Wong <e@80x24.org> wrote:
> Still haven't found anything which is causing problems on korg,
> but found a bunch of worthwhile cleanups, clarifications
> and perhaps minor efficiency improvements that I'm comfortable
> putting on 'master'.
This might help narrow down where the FD leak is if it stops
pipes (but not regular files) from leaking. However, if it
fixes things, I also don't understand why it'd work, but I'm
mostly running on fumes at this point...
diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm
index 5a30064..3bf5c03 100644
--- a/lib/PublicInbox/Qspawn.pm
+++ b/lib/PublicInbox/Qspawn.pm
@@ -224,7 +224,7 @@ sub filter_fh ($$) {
# immediately (or streamed via ->getline (pull-based)).
sub psgi_return {
my ($self, $env, $limiter, $parse_hdr) = @_;
- my ($fh, $rpipe);
+ my $fh;
my $end = sub {
my $err = $_[0]; # $!
log_err($env, "psgi_return: $err") if defined($err);
@@ -233,6 +233,7 @@ sub psgi_return {
};
my $buf = '';
+ my $rpipe;
my $rd_hdr = sub {
# typically used for reading CGI headers
# we must loop until EAGAIN for EPOLLET in HTTPD/Async.pm
@@ -275,6 +276,7 @@ sub psgi_return {
$fh = $wcb->($r); # scalar @$r == 2
$fh = filter_fh($fh, $filter) if $filter;
$async->async_pass($env->{'psgix.io'}, $fh, \$buf);
+ $rpipe = undef;
} else { # for synchronous PSGI servers
require PublicInbox::GetlineBody;
$r->[2] = PublicInbox::GetlineBody->new($rpipe, $end,
next prev parent reply other threads:[~2019-09-17 9:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 8:31 [PATCH 0/6] qspawn-related cleanups, comments, and minor fix Eric Wong
2019-09-17 8:31 ` [PATCH 1/6] qspawn: remove return value from ->finish Eric Wong
2019-09-17 8:31 ` [PATCH 2/6] qspawn: log errors for generic PSGI server users Eric Wong
2019-09-17 8:31 ` [PATCH 3/6] qspawn: shorten lifetime of circular references Eric Wong
2019-09-17 8:31 ` [PATCH 4/6] qspawn: improve variable naming and commenting Eric Wong
2019-09-17 8:31 ` [PATCH 5/6] http: drop unused `$env' variable after delete Eric Wong
2019-09-17 8:31 ` [PATCH 6/6] http: remove unnecessary delete Eric Wong
2019-09-17 9:19 ` Eric Wong [this message]
2019-09-17 9:40 ` [MAYBE] kill rpipe early 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=20190917091915.o5nylhjzk2g7rwax@dcvr \
--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).