From 3344815088512287243b622658dbb7fbea87beb1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 27 May 2016 08:20:59 +0000 Subject: git-http-backend: close pipe for generic PSGI on errors The generic PSGI code needs to avoid resource leaks if smart cloning is disabled (due to resource contraints). --- lib/PublicInbox/GitHTTPBackend.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm index 18194441..58e75cde 100644 --- a/lib/PublicInbox/GitHTTPBackend.pm +++ b/lib/PublicInbox/GitHTTPBackend.pm @@ -210,7 +210,12 @@ sub serve_smart { my $r = $rd_hdr->() or return; $rd_hdr = undef; if (scalar(@$r) == 3) { # error: - $async->close if $async; + if ($async) { + $async->close; # calls rpipe->close + } else { + $rpipe->close; + $end->(); + } return $res->($r); } if ($async) { -- cgit v1.2.3-24-ge0c7