[java-identity-provider] branch main updated: IDP-1658: httpclient sockets stuck in CLOSE_WAIT break CAS proxy ...

Brent Putman putmanb at georgetown.edu
Fri Aug 21 16:35:04 UTC 2020


This is an automated email from the git hooks/post-receive script.

putmanb pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=57a7e4d2f805d6fbbf99928d71eac08f78b3b864

The following commit(s) were added to refs/heads/main by this push:
       new  57a7e4d2f IDP-1658: httpclient sockets stuck in CLOSE_WAIT break CAS proxy ...
57a7e4d2f is described below

commit 57a7e4d2f805d6fbbf99928d71eac08f78b3b864
Author: Brent Putman <putmanb at georgetown.edu>
AuthorDate: Fri Aug 21 12:35:01 2020 -0400

    IDP-1658: httpclient sockets stuck in CLOSE_WAIT break CAS proxy ...
    
    httpclient sockets stuck in CLOSE_WAIT break CAS proxy callback
---
 .../idp/cas/proxy/impl/HttpClientProxyValidator.java          | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/proxy/impl/HttpClientProxyValidator.java b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/proxy/impl/HttpClientProxyValidator.java
index fc4614bd5..68a7fe5bd 100644
--- a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/proxy/impl/HttpClientProxyValidator.java
+++ b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/proxy/impl/HttpClientProxyValidator.java
@@ -46,6 +46,7 @@ import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.CloseableHttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.protocol.HttpClientContext;
 
@@ -157,7 +158,7 @@ public class HttpClientProxyValidator implements ProxyValidator {
         final HttpClientContext clientContext = HttpClientContext.create();
         HttpClientSecuritySupport.marshalSecurityParameters(clientContext, securityParameters, true);
         setCASTLSTrustEngineCriteria(clientContext, uri, service);
-        final HttpResponse response;
+        HttpResponse response = null;
         try {
             log.debug("Attempting to validate CAS proxy callback URI {}", uri);
             final HttpGet request = new HttpGet(uri);
@@ -175,6 +176,14 @@ public class HttpClientProxyValidator implements ProxyValidator {
             throw new GeneralSecurityException("SSL connection error", e);
         } catch (final IOException e) {
             throw new GeneralSecurityException("IO error", e);
+        } finally {
+            if (response != null && CloseableHttpResponse.class.isInstance(response)) {
+                try {
+                    CloseableHttpResponse.class.cast(response).close();
+                } catch (IOException e) {
+                    log.debug("Error closing HttpResponse", e);
+                }
+            }
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list