You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (JIRA)" <ji...@apache.org> on 2016/08/29 08:26:21 UTC

[jira] [Resolved] (HTTPASYNC-112) Intermittent ConnectionClosedException/Connection reset by peer with httpasynclient version 4.1.2

     [ https://issues.apache.org/jira/browse/HTTPASYNC-112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPASYNC-112.
-----------------------------------------
    Resolution: Invalid

It is perfectly legal for both HTTP endpoints to close a connection at any point of message transaction execution. Both endpoints need to be prepared to deal with closed connections. The client can mitigate the problem by retrying the message exchange. 

Oleg 

> Intermittent ConnectionClosedException/Connection reset by peer with httpasynclient version 4.1.2
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPASYNC-112
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-112
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Bug
>    Affects Versions: 4.1.2
>            Reporter: Venkata Satya Teja Siram
>              Labels: HTTP
>
> Hi Team,
> We have three applications A,B and C deployed on same tomcat server.There is an HTTP call that happens between application A to B(REST CALL) and another http call from B to C(REST CALL)
> we were using synchronous HTTP call initially,recently we changed our code to Asynchronous call using  httpasynclient version 4.1.2.
> We have used HttpAsyncClients forREST calls (Application A to call Application B) and for (Application B to call Application C)..
> We have faced three different Exceptions.All the three Exceptions are intermittent.
>  CloseableHttpAsyncClient  client = HttpAsyncClients.custom()
>                         .setMaxConnPerRoute(100)
>                         .setMaxConnTotal(150).build();
> and for Every request we gave timeout of 
>  
>     final RequestConfig params = RequestConfig.custom().setConnectTimeout(300000) // 5min
>                         .setSocketTimeout(300000).setConnectionRequestTimeout(300000).build();
> Port range config on the machines where exception came are :
> net.ipv4.ip_local_port_range = 32768 61000
> Please find the below stack trace:
> =========================================================
> Stack Trace1:   Connection Reset by peer
> java.io.IOException: Connection reset by peer
>         at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[na:1.8.0_60]
>         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[na:1.8.0_60]
>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[na:1.8.0_60]
>         at sun.nio.ch.IOUtil.read(IOUtil.java:197) ~[na:1.8.0_60]
>         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) ~[na:1.8.0_60]
>         at org.apache.http.impl.nio.reactor.SessionInputBufferImpl.fill(SessionInputBufferImpl.java:204) ~[httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.codecs.AbstractMessageParser.fillBuffer(AbstractMessageParser.java:136) ~[httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:241) ~[httpcore-nio-4.4.5.jar:na]
>         at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588) [httpcore-nio-4.4.5.jar:4.4.5]
>         at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
> =========================================================
> Stack Trace2:   org.apache.http.ConnectionClosedException: Connection closed
> org.apache.http.ConnectionClosedException: Connection closed
>         at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.connectionAllocated(AbstractClientExchangeHandler.java:320) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.access$000(AbstractClientExchangeHandler.java:62) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.AbstractClientExchangeHandler$1.completed(AbstractClientExchangeHandler.java:373) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.AbstractClientExchangeHandler$1.completed(AbstractClientExchangeHandler.java:369) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119) [httpcore-4.4.4.jar:na]
>         at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$InternalPoolEntryCallback.completed(PoolingNHttpClientConnectionManager.java:494) [httpasyncclient-4.1.2.jar:4.1.2]
>         at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$InternalPoolEntryCallback.completed(PoolingNHttpClientConnectionManager.java:477) [httpasyncclient-4.1.2.jar:4.1.2]
>         at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:119) [httpcore-4.4.4.jar:na]
>         at org.apache.http.nio.pool.AbstractNIOConnPool.fireCallbacks(AbstractNIOConnPool.java:456) [httpcore-nio-4.4.5.jar:na]
>         at org.apache.http.nio.pool.AbstractNIOConnPool.lease(AbstractNIOConnPool.java:286) [httpcore-nio-4.4.5.jar:na]
>         at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.requestConnection(PoolingNHttpClientConnectionManager.java:266) [httpasyncclient-4.1.2.jar:4.1.2]
>         at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.requestConnection(AbstractClientExchangeHandler.java:363) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.start(DefaultClientExchangeHandlerImpl.java:125) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:141) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(CloseableHttpAsyncClient.java:75) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(CloseableHttpAsyncClient.java:108) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.CloseableHttpAsyncClient.execute(CloseableHttpAsyncClient.java:92) [httpasyncclient-4.1.2.jar:na]
> =========================================================
> Stack Trace3:   org.apache.http.ConnectionClosedException: Connection closed
> org.apache.http.ConnectionClosedException: Connection closed
>         at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.endOfInput(HttpAsyncRequestExecutor.java:344) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:261) [httpcore-nio-4.4.5.jar:na]
>         at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39) [httpasyncclient-4.1.2.jar:na]
>         at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) [httpcore-nio-4.4.5.jar:4.4.5]
>         at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:588) [httpcore-nio-4.4.5.jar:4.4.5]
>         at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
> Team it would be really helpful if you let us know is there any problem related or configuration of 
> 1.Http async client configuration
> 2.Tcp ports
> 3.problem with specific version of Http async library on the server.
> 4.Race Condition(High load on server)
> And all the above exceptions are intermittently happening.
> Request to update if there are any issues related to configuration.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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