[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-2314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17803957#comment-17803957
 ] 

Philip Helger commented on HTTPCLIENT-2314:
-------------------------------------------

Okay thanks . Sorry, it gets a bit more messy, but I found a way to reproduce 
it locally.

I mixed the 5.4-alpha branch with the 5.3.x branch for the issue on the debug 
log - that is not present in 5.3.x but good to have it fixed.

Additionally I found out, that I am using a custom DNS resolver which indeed 
returns an empty array instead of throwing an UnknownHostException.

That means, that the following code in "DefaultHttpClientConnectionOperator" 
(line 143 in 5.3.x branch) gets an empty array:
{color:#6a3e3e}remoteAddresses{color}{color:#000000} = 
{color}{color:#7f0055}this{color}{color:#000000}.{color}{color:#0000c0}dnsResolver{color}{color:#000000}.resolve({color}{color:#6a3e3e}host{color}{color:#000000}.getHostName());{color}

{color:#7f0055}if{color}{color:#000000} 
({color}{color:#0000c0}LOG{color}{color:#000000}.isDebugEnabled()) {{color}

{color:#000000} 
{color}{color:#0000c0}LOG{color}{color:#000000}.debug({color}{color:#2a00ff}"{} 
resolved to {}"{color}{color:#000000}, 
{color}{color:#6a3e3e}host{color}{color:#000000}.getHostName(), 
Arrays.{color}{color:#000000}asList{color}{color:#000000}({color}{color:#6a3e3e}remoteAddresses{color}{color:#000000}));{color}

{color:#000000}}{color}

(btw. 
{color:#000000}Arrays.{color}{color:#000000}asList{color}{color:#000000}({color}{color:#6a3e3e}remoteAddresses{color}{color:#000000})
 will throw an Exception if param is null){color}

{color:#000000}I create a fork of httpclient with my local changes at 
[https://github.com/phax/httpcomponents-client/tree/5.3.x] - is it okay to make 
a PR, or is there a better way to resolve it?{color}

> IllegalStateException: Endpoint is not connected
> ------------------------------------------------
>
>                 Key: HTTPCLIENT-2314
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2314
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 5.2, 5.3
>            Reporter: Philip Helger
>            Priority: Minor
>             Fix For: 5.3.1
>
>         Attachments: debuglog-httpclient-2314.txt, httpclient-2314-1.txt, 
> httpclient-2314-2.txt
>
>
> Using `PoolingHttpClientConnectionManager`, under high traffic situations it 
> occurs consistently that the exception "Endpoint is not connected" is invoked.
>  
> The full stacktrace looks like this:
> {{Caused by: java.lang.IllegalStateException: Endpoint is not connected}}
> {{    at org.apache.hc.core5.util.Asserts.check(Asserts.java:38) 
> ~[httpcore5-5.2.4.jar:5.2.4]}}
> {{    at 
> org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$InternalConnectionEndpoint.getValidatedPoolEntry(PoolingHttpClientConnectionManager.java:664)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$InternalConnectionEndpoint.setSocketTimeout(PoolingHttpClientConnectionManager.java:697)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.InternalExecRuntime.execute(InternalExecRuntime.java:211)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.MainClientExec.execute(MainClientExec.java:116)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:188)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:113)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:245)
>  ~[httpclient5-5.3.jar:5.3]}}
> {{    at 
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:188)
>  ~[httpclient5-5.3.jar:5.3]}}
>  
> Unfortunately I don't have a standalone example to reproduce it.
> Any suggestions for a workaround????



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to