Nitu Choudhary
2017-11-22 20:19:57 UTC
Hi,
Under high concurrency we see cases where I/O reactor is getting terminated
when closing the input stream. In our application we also close the input
stream as we want to cleanup the memory under various exception conditions.
What is the recommended way to consume the http entity? It shows that on
timeout the nio client is trying to consume the entity, but it has already
been consumed by our application as it got a done signal, and we retrieved
the entity and closed it.
Here is the stack for your reference:
org.apache.http.impl.nio.client.InternalHttpAsyncClient - I/O reactor
terminated abnormally java.util.NoSuchElementException: null at java.util.
ArrayList$Itr.next(ArrayList.java:854) at java.util.Collections$3.nextEl
ement(Collections.java:5216) at java.io.SequenceInputStream.nextStream(
SequenceInputStream.java:110) at java.io.SequenceInputStream.close(
SequenceInputStream.java:232) at org.apache.http.nio.entity.Ent
ityAsyncContentProducer.close(EntityAsyncContentProducer.java:92) at org.
apache.http.nio.protocol.BasicAsyncRequestProducer.close(
BasicAsyncRequestProducer.java:155) at org.apache.http.impl.nio.client.
DefaultClientExchangeHandlerImpl.releaseResources(DefaultC
lientExchangeHandlerImpl.java:84) at org.apache.http.impl.nio.client.
AbstractClientExchangeHandler.failed(AbstractClientExchangeHandler.java:429)
at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.
connectionRequestFailed(AbstractClientExchangeHandler.java:348) at org.
apache.http.impl.nio.client.AbstractClientExchangeHandler.access$100(
AbstractClientExchangeHandler.java:62) at org.apache.http.impl.nio.client.
AbstractClientExchangeHandler$1.failed(AbstractClientExchangeHandler.java:
392) at org.apache.http.concurrent.BasicFuture.failed(BasicFuture.java:134)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$1.
failed(PoolingNHttpClientConnectionManager.java:289) at org.apache.http.
concurrent.BasicFuture.failed(BasicFuture.java:134) at org.apache.http.nio.
pool.RouteSpecificPool.timeout(RouteSpecificPool.java:168) at org.apache.
http.nio.pool.AbstractNIOConnPool.requestTimeout(AbstractNIOConnPool.java:
584) at org.apache.http.nio.pool.AbstractNIOConnPool$InternalSession
RequestCallback.timeout(AbstractNIOConnPool.java:851) at org.apache.http.
impl.nio.reactor.SessionRequestImpl.timeout(SessionRequestImpl.java:183) at
org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processTimeouts(
DefaultConnectingIOReactor.java:210) at org.apache.http.impl.nio.reactor.
DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:155)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(
AbstractMultiworkerIOReactor.java:348) at org.apache.http.impl.nio.conn.
PoolingNHttpClientConnectionManager.execute(PoolingNHttpClie
ntConnectionManager.java:194) at org.apache.http.impl.nio.client.
CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64) at
java.lang.Thread.run(Thread.java:748)
regards,
nitu
Under high concurrency we see cases where I/O reactor is getting terminated
when closing the input stream. In our application we also close the input
stream as we want to cleanup the memory under various exception conditions.
What is the recommended way to consume the http entity? It shows that on
timeout the nio client is trying to consume the entity, but it has already
been consumed by our application as it got a done signal, and we retrieved
the entity and closed it.
Here is the stack for your reference:
org.apache.http.impl.nio.client.InternalHttpAsyncClient - I/O reactor
terminated abnormally java.util.NoSuchElementException: null at java.util.
ArrayList$Itr.next(ArrayList.java:854) at java.util.Collections$3.nextEl
ement(Collections.java:5216) at java.io.SequenceInputStream.nextStream(
SequenceInputStream.java:110) at java.io.SequenceInputStream.close(
SequenceInputStream.java:232) at org.apache.http.nio.entity.Ent
ityAsyncContentProducer.close(EntityAsyncContentProducer.java:92) at org.
apache.http.nio.protocol.BasicAsyncRequestProducer.close(
BasicAsyncRequestProducer.java:155) at org.apache.http.impl.nio.client.
DefaultClientExchangeHandlerImpl.releaseResources(DefaultC
lientExchangeHandlerImpl.java:84) at org.apache.http.impl.nio.client.
AbstractClientExchangeHandler.failed(AbstractClientExchangeHandler.java:429)
at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.
connectionRequestFailed(AbstractClientExchangeHandler.java:348) at org.
apache.http.impl.nio.client.AbstractClientExchangeHandler.access$100(
AbstractClientExchangeHandler.java:62) at org.apache.http.impl.nio.client.
AbstractClientExchangeHandler$1.failed(AbstractClientExchangeHandler.java:
392) at org.apache.http.concurrent.BasicFuture.failed(BasicFuture.java:134)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$1.
failed(PoolingNHttpClientConnectionManager.java:289) at org.apache.http.
concurrent.BasicFuture.failed(BasicFuture.java:134) at org.apache.http.nio.
pool.RouteSpecificPool.timeout(RouteSpecificPool.java:168) at org.apache.
http.nio.pool.AbstractNIOConnPool.requestTimeout(AbstractNIOConnPool.java:
584) at org.apache.http.nio.pool.AbstractNIOConnPool$InternalSession
RequestCallback.timeout(AbstractNIOConnPool.java:851) at org.apache.http.
impl.nio.reactor.SessionRequestImpl.timeout(SessionRequestImpl.java:183) at
org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processTimeouts(
DefaultConnectingIOReactor.java:210) at org.apache.http.impl.nio.reactor.
DefaultConnectingIOReactor.processEvents(DefaultConnectingIOReactor.java:155)
at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor.execute(
AbstractMultiworkerIOReactor.java:348) at org.apache.http.impl.nio.conn.
PoolingNHttpClientConnectionManager.execute(PoolingNHttpClie
ntConnectionManager.java:194) at org.apache.http.impl.nio.client.
CloseableHttpAsyncClientBase$1.run(CloseableHttpAsyncClientBase.java:64) at
java.lang.Thread.run(Thread.java:748)
regards,
nitu