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.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 A07861F463; Tue, 17 Sep 2019 09:19:15 +0000 (UTC) Date: Tue, 17 Sep 2019 09:19:15 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [MAYBE] kill rpipe early Message-ID: <20190917091915.o5nylhjzk2g7rwax@dcvr> References: <20190917083123.6468-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190917083123.6468-1-e@80x24.org> List-Id: Eric Wong 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,