LP#1478123: fix leak of file descriptors by Apache workers
authorJosh Stompro <stomproj@larl.org>
Fri, 24 Jul 2015 19:20:21 +0000 (14:20 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 18 Aug 2015 01:58:12 +0000 (01:58 +0000)
Apache backends handling TPAC requests and making requests
of the added content handler were not properly closing
their sockets. This patch adds a close() after the shutdown()
to plug the leak.

Signed-off-by: Josh Stompro <stomproj@larl.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm

index cf8ea00..be1a402 100644 (file)
@@ -574,7 +574,10 @@ sub added_content_stage2 {
             }
         }
         # To avoid a lot of hanging connections.
-        $content->{request}->shutdown(2) if ($content->{request});
+        if ($content->{request}) {
+            $content->{request}->shutdown(2);
+            $content->{request}->close();
+        } 
     }
 }