From 2fc42236f72ad16a33288f58086edc95da56c612 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 27 Sep 2019 21:01:01 +0000 Subject: qspawn: workaround Perl 5.16.3 leak, re-enable Deflater The httpd-supplied write callback is the leak culprit under Perl 5.16.3. undef-ing it immediately after use keeps a repeated "git fetch" loop from monotonically increasing memory and FD use on the Perl shipped with RHEL/CentOS 7.x. Other endpoints tested showed no increase in memory use under constant load with "ab -HAccept-Encoding:gzip -k", including the async psgi_qx code path used by $INBOX_URL/$OBJECT_ID/s/ via SolverGit module. --- lib/PublicInbox/Qspawn.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/Qspawn.pm b/lib/PublicInbox/Qspawn.pm index 5a300644..cb3dc516 100644 --- a/lib/PublicInbox/Qspawn.pm +++ b/lib/PublicInbox/Qspawn.pm @@ -281,6 +281,10 @@ sub psgi_return { $buf, $filter); $wcb->($r); } + + # Workaround a leak under Perl 5.16.3 when combined with + # Plack::Middleware::Deflater: + $wcb = undef; }; $limiter ||= $def_limiter ||= PublicInbox::Qspawn::Limiter->new(32); my $start_cb = sub { # may run later, much later... -- cgit v1.2.3-24-ge0c7