From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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, URIBL_BLOCKED shortcircuit=no autolearn=unavailable autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D06EE1FCC6 for ; Fri, 27 May 2016 08:27:10 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/2] git-http-backend: close pipe for generic PSGI on errors Date: Fri, 27 May 2016 08:27:09 +0000 Message-Id: <20160527082709.17629-3-e@80x24.org> In-Reply-To: <20160527082709.17629-1-e@80x24.org> References: <20160527082709.17629-1-e@80x24.org> List-Id: 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 1819444..58e75cd 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) {