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) {
--
unsubscribe: meta+unsubscr...@public-inbox.org
archive: https://public-inbox.org/meta/

Reply via email to