Dominik Derwiński created HTTPCLIENT-2125:
---------------------------------------------

             Summary: NullPointerException in BasicHttpClientConnectionManager
                 Key: HTTPCLIENT-2125
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2125
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (classic)
    Affects Versions: 5.0.3
            Reporter: Dominik Derwiński


After switching to HttpClient 5 I get a NPE in a code that was previously 
working. It's a pretty simple line
{noformat}
try (CloseableHttpResponse response = httpclient.execute(get, context)) {
{noformat}
which causes this:
{noformat}
Caused by: java.lang.NullPointerException
        at 
org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager.release(BasicHttpClientConnectionManager.java:278)
        at 
org.apache.hc.client5.http.impl.classic.InternalExecRuntime.discardEndpoint(InternalExecRuntime.java:245)
        at 
org.apache.hc.client5.http.impl.classic.InternalExecRuntime.releaseEndpoint(InternalExecRuntime.java:259)
        at 
org.apache.hc.client5.http.impl.classic.MainClientExec.execute(MainClientExec.java:136)
        at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
        at 
org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:181)
        at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
        at 
org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:172)
        at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
        at 
org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:93)
        at 
org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at 
org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
        at 
org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:128)
        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:178)
        at 
org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:75)
{noformat}
The request itself seems to be working, the problem is closing connection (I'm 
using a NoConnectionReuseStrategy which mimics the old Strategy available in 
version 4). This is in the log before crash:
{noformat}
[2020-11-02 16:35:53.389] 
[org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection] [main] 
[DEBUG] [org.apache.hc.client5.http.impl.io.DefaultManagedHttpClientConnection] 
[close] [143] : http-outgoing-0: close connection IMMEDIATE
[2020-11-02 16:35:53.390] 
[org.apache.hc.client5.http.impl.classic.InternalHttpClient] [main] [DEBUG] 
[org.apache.hc.client5.http.impl.classic.InternalExecRuntime] [discardEndpoint] 
[239] : InternalConnectionEndpoint-5175d9ad: endpoint closed
[2020-11-02 16:35:53.390] 
[org.apache.hc.client5.http.impl.classic.InternalHttpClient] [main] [DEBUG] 
[org.apache.hc.client5.http.impl.classic.InternalExecRuntime] [discardEndpoint] 
[243] : InternalConnectionEndpoint-5175d9ad: discarding endpoint
[2020-11-02 16:35:53.390] 
[org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager] [main] 
[DEBUG] [org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager] 
[closeConnection] [209] : Closing connection GRACEFUL
{noformat}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to