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

ASF subversion and git services commented on HTTPCLIENT-2316:
-------------------------------------------------------------

Commit 6792909791facf02e2d0cc4d401613784f4aeb3d in httpcomponents-client's 
branch refs/heads/5.3.x from Oleg Kalnichevski
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-client.git;h=679290979 ]

HTTPCLIENT-2316: BasicHttpClientConnectionManager incorrectly re-uses the 
released connection if it has been closed out by the protocol handler


> ConnectionShutdownException when connection is closed for 401 response
> ----------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2316
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2316
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 5.3.1
>         Environment: Ubuntu Linux, Java 17.0.10, connecting to an Apache Web 
> Server
>            Reporter: Stephan Windmüller
>            Priority: Major
>         Attachments: log-output-38d8d9b.txt, log-output-8266a9c.txt, 
> log-output.txt
>
>
> When a connection is used for multiple requests, the {{Keep-Alive}} header 
> has a {{max}} value that is reduced until it reaches 0, resulting in a 
> {{Connection: closed}} header. If that happens while a 401 response is 
> handled, the following code is executed:
> {code:java}
> org.apache.hc.client5.http.impl.classic.InternalExecRuntime.markConnectionNonReusable(InternalExecRuntime.java:233)
>       at 
> org.apache.hc.client5.http.impl.classic.MainClientExec.execute(MainClientExec.java:142)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:188)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:113)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
>       at 
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:87)
>       at 
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:55)
>       at 
> org.apache.hc.client5.http.classic.HttpClient.executeOpen(HttpClient.java:183)
>       at 
> org.apache.hc.client5.http.fluent.Request.internalExecute(Request.java:201)
>       at org.apache.hc.client5.http.fluent.Executor.execute(Executor.java:244)
> {code}
> After that, 
> {{org.apache.hc.client5.http.impl.classic.InternalExecRuntime#disconnectEndpoint}}
>  is called. Any further attempt to use that connection results in this 
> stacktrace:
> {code:java}
> org.apache.hc.client5.http.impl.ConnectionShutdownException
>       at 
> org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager$InternalConnectionEndpoint.getConnection(BasicHttpClientConnectionManager.java:502)
>       at 
> org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager$InternalConnectionEndpoint.isConnected(BasicHttpClientConnectionManager.java:519)
>       at 
> org.apache.hc.client5.http.impl.classic.InternalExecRuntime.isEndpointConnected(InternalExecRuntime.java:149)
>       at 
> org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:128)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:192)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:113)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:152)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
>       at 
> org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
>       at 
> org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:170)
>       at 
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:87)
>       at 
> org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:55)
>       at 
> org.apache.hc.client5.http.classic.HttpClient.executeOpen(HttpClient.java:183)
>       at 
> org.apache.hc.client5.http.fluent.Request.internalExecute(Request.java:201)
>       at org.apache.hc.client5.http.fluent.Executor.execute(Executor.java:244)
> {code}
> The behaviour sounds a bit like HTTPASYNC-63.



--
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