# ElasticSearch exception: java.lang.IllegalStateException: cannot send more responses than requests

**URL:** <https://discuss.elastic.co/t/elasticsearch-exception-java-lang-illegalstateexception-cannot-send-more-responses-than-requests/5461>\
**Category:** Elasticsearch\
**Created:** [September 27, 2011, 9:51am UTC](https://discuss.elastic.co/t/elasticsearch-exception-java-lang-illegalstateexception-cannot-send-more-responses-than-requests/5461 "2011-09-27T09:51:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pcdinh](https://avatars.discourse-cdn.com/v4/letter/p/76d3ee/32.png) [@pcdinh](https://discuss.elastic.co/u/pcdinh)\
**Post date:** [September 27, 2011, 9:51am UTC](https://discuss.elastic.co/t/elasticsearch-exception-java-lang-illegalstateexception-cannot-send-more-responses-than-requests/5461/1 "2011-09-27T09:51:35Z")

</div>

Hi,

I got a lot of exceptions in the log file

[2011-09-27 08:39:56,940][WARN][http.netty] [Professor X]  
Caught exception while handling client http traffic, closing connection  
java.lang.IllegalStateException: cannot send more responses than requests  
at  
org.elasticsearch.common.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:102)  
at  
org.elasticsearch.common.netty.channel.SimpleChannelHandler.handleDownstream(SimpleChannelHandler.java:266)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)  
at  
org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:582)  
at  
org.elasticsearch.common.netty.channel.Channels.write(Channels.java:611)  
at  
org.elasticsearch.common.netty.channel.Channels.write(Channels.java:578)  
at  
org.elasticsearch.common.netty.channel.AbstractChannel.write(AbstractChannel.java:251)  
at  
org.elasticsearch.http.netty.NettyHttpChannel.sendResponse(NettyHttpChannel.java:156)  
at  
org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexAction.java:123)  
at  
org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexAction.java:101)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performReplicas(TransportShardReplicationOperationAction.java:493)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:465)  
at  
org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:377)  
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(.java:886)  
at  
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
at java.lang.Thread.run(Thread.java:662)

Version in use: 0.17.7

What does it mean?

Thanks

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 27, 2011, 9:13pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-java-lang-illegalstateexception-cannot-send-more-responses-than-requests/5461/2 "2011-09-27T21:13:14Z")

</div>

Are you sure you are using 0.17.7? it basically means that a response was  
sent twice on the same open channel, which should not happen.

On Tue, Sep 27, 2011 at 12:51 PM, pcdinh [pcdinh@gmail.com](mailto:pcdinh@gmail.com) wrote:

> Hi,
> 
> I got a lot of exceptions in the log file
> 
> [2011-09-27 08:39:56,940][WARN][http.netty] [Professor X]  
> Caught exception while handling client http traffic, closing connection  
> java.lang.IllegalStateException: cannot send more responses than requests  
> at  
> org.elasticsearch.common.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:102)  
> at  
> org.elasticsearch.common.netty.channel.SimpleChannelHandler.handleDownstream(SimpleChannelHandler.java:266)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:591)  
> at  
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstream(DefaultChannelPipeline.java:582)  
> at  
> org.elasticsearch.common.netty.channel.Channels.write(Channels.java:611)  
> at  
> org.elasticsearch.common.netty.channel.Channels.write(Channels.java:578)  
> at  
> org.elasticsearch.common.netty.channel.AbstractChannel.write(AbstractChannel.java:251)  
> at  
> org.elasticsearch.http.netty.NettyHttpChannel.sendResponse(NettyHttpChannel.java:156)  
> at  
> org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexAction.java:123)  
> at  
> org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexAction.java:101)  
> at  
> org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performReplicas(TransportShardReplicationOperationAction.java:493)  
> at  
> org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplicationOperationAction.java:465)  
> at  
> org.elasticsearch.action.support.replication.TransportShardReplicationOperationAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperationAction.java:377)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(.java:886)  
> at  
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)  
> at java.lang.Thread.run(Thread.java:662)
> 
> Version in use: 0.17.7
> 
> What does it mean?
> 
> Thanks

---

<div class="post-metadata">

**Author:** ![Josh\_Holtzman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/josh_holtzman/32/1890_2.png) [@Josh\_Holtzman](https://discuss.elastic.co/u/Josh_Holtzman)\
**Post date:** [November 21, 2011, 5:01pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-java-lang-illegalstateexception-cannot-send-more-responses-than-requests/5461/3 "2011-11-21T17:01:52Z")

</div>

I see the same exception under heavy load on elasticsearch 0.18.2.  
I'm using the multithreaded apache http client to run performance  
tests, so this could have something to do with handling of multiple  
concurrent persistent connections:

HttpClient httpClient = new DefaultHttpClient(new  
ThreadSafeClientConnManager());

I'll re-run my tests using separate http clients per thread to see if  
I can reproduce it.

Josh

On Sep 27, 1:13 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Are you sure you are using 0.17.7? it basically means that a response was  
> sent twice on the same open channel, which should not happen.
> 
> On Tue, Sep 27, 2011 at 12:51 PM, pcdinh [pcd...@gmail.com](mailto:pcd...@gmail.com) wrote:
> 
> > Hi,
> 
> > I got a lot of exceptions in the log file
> 
> > [2011-09-27 08:39:56,940][WARN][http.netty] [Professor X]  
> > Caught exception while handling client http traffic, closing connection  
> > java.lang.IllegalStateException: cannot send more responses than requests  
> > at  
> > org.elasticsearch.common.netty.handler.codec.http.HttpContentEncoder.writeR equested(HttpContentEncoder.java:102)  
> > at  
> > org.elasticsearch.common.netty.channel.SimpleChannelHandler.handleDownstrea m(SimpleChannelHandler.java:266)  
> > at  
> > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstrea m(DefaultChannelPipeline.java:591)  
> > at  
> > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstrea m(DefaultChannelPipeline.java:582)  
> > at  
> > org.elasticsearch.common.netty.channel.Channels.write(Channels.java:611)  
> > at  
> > org.elasticsearch.common.netty.channel.Channels.write(Channels.java:578)  
> > at  
> > org.elasticsearch.common.netty.channel.AbstractChannel.write(AbstractChanne l.java:251)  
> > at  
> > org.elasticsearch.http.netty.NettyHttpChannel.sendResponse(NettyHttpChannel .java:156)  
> > at  
> > org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexA ction.java:123)  
> > at  
> > org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexA ction.java:101)  
> > at  
> > org.elasticsearch.action.support.replication.TransportShardReplicationOpera tionAction$AsyncShardOperationAction.performReplicas(TransportShardReplicat ionOperationAction.java:493)  
> > at  
> > org.elasticsearch.action.support.replication.TransportShardReplicationOpera tionAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplica tionOperationAction.java:465)  
> > at  
> > org.elasticsearch.action.support.replication.TransportShardReplicationOpera tionAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperati onAction.java:377)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(.java:886)  
> > at  
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java: 908)  
> > at java.lang.Thread.run(Thread.java:662)
> 
> > Version in use: 0.17.7
> 
> > What does it mean?
> 
> > Thanks

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 22, 2011, 12:41pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-java-lang-illegalstateexception-cannot-send-more-responses-than-requests/5461/4 "2011-11-22T12:41:42Z")

</div>

Can you gist the exception you got?

On Mon, Nov 21, 2011 at 7:01 PM, jholtzman [jmholtzman@gmail.com](mailto:jmholtzman@gmail.com) wrote:

> I see the same exception under heavy load on elasticsearch 0.18.2.  
> I'm using the multithreaded apache http client to run performance  
> tests, so this could have something to do with handling of multiple  
> concurrent persistent connections:
> 
> HttpClient httpClient = new DefaultHttpClient(new  
> ThreadSafeClientConnManager());
> 
> I'll re-run my tests using separate http clients per thread to see if  
> I can reproduce it.
> 
> Josh
> 
> On Sep 27, 1:13 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > Are you sure you are using 0.17.7? it basically means that a response was  
> > sent twice on the same open channel, which should not happen.
> > 
> > On Tue, Sep 27, 2011 at 12:51 PM, pcdinh [pcd...@gmail.com](mailto:pcd...@gmail.com) wrote:
> > 
> > > Hi,
> > 
> > > I got a lot of exceptions in the log file
> > 
> > > [2011-09-27 08:39:56,940][WARN][http.netty] [Professor  
> > > X]  
> > > Caught exception while handling client http traffic, closing connection  
> > > java.lang.IllegalStateException: cannot send more responses than  
> > > requests  
> > > at
> 
> org.elasticsearch.common.netty.handler.codec.http.HttpContentEncoder.writeR  
> equested(HttpContentEncoder.java:102)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.common.netty.channel.SimpleChannelHandler.handleDownstrea  
> m(SimpleChannelHandler.java:266)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstrea  
> m(DefaultChannelPipeline.java:591)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstrea  
> m(DefaultChannelPipeline.java:582)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.common.netty.channel.Channels.write(Channels.java:611)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.common.netty.channel.Channels.write(Channels.java:578)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.common.netty.channel.AbstractChannel.write(AbstractChanne  
> l.java:251)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.http.netty.NettyHttpChannel.sendResponse(NettyHttpChannel  
> .java:156)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexA  
> ction.java:123)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexA  
> ction.java:101)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.action.support.replication.TransportShardReplicationOpera  
> tionAction$AsyncShardOperationAction.performReplicas(TransportShardReplicat  
> ionOperationAction.java:493)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.action.support.replication.TransportShardReplicationOpera  
> tionAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplica  
> tionOperationAction.java:465)
> 
> > > ```
> > > at
> > > 
> > > ```
> 
> org.elasticsearch.action.support.replication.TransportShardReplicationOpera  
> tionAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperati  
> onAction.java:377)
> 
> > > ```
> > > at
> > > 
> > > ```
> > > 
> > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(.java:886)  
> > > at
> 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:  
> 908)
> 
> > > ```
> > > at java.lang.Thread.run(Thread.java:662)
> > > 
> > > ```
> > 
> > > Version in use: 0.17.7
> > 
> > > What does it mean?
> > 
> > > Thanks

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 22, 2011, 12:42pm UTC](https://discuss.elastic.co/t/elasticsearch-exception-java-lang-illegalstateexception-cannot-send-more-responses-than-requests/5461/5 "2011-11-22T12:42:01Z")

</div>

And, if you have a simple test case, would love to run it myself.

On Tue, Nov 22, 2011 at 2:41 PM, Shay Banon [kimchy@gmail.com](mailto:kimchy@gmail.com) wrote:

> Can you gist the exception you got?
> 
> On Mon, Nov 21, 2011 at 7:01 PM, jholtzman [jmholtzman@gmail.com](mailto:jmholtzman@gmail.com) wrote:
> 
> > I see the same exception under heavy load on elasticsearch 0.18.2.  
> > I'm using the multithreaded apache http client to run performance  
> > tests, so this could have something to do with handling of multiple  
> > concurrent persistent connections:
> > 
> > HttpClient httpClient = new DefaultHttpClient(new  
> > ThreadSafeClientConnManager());
> > 
> > I'll re-run my tests using separate http clients per thread to see if  
> > I can reproduce it.
> > 
> > Josh
> > 
> > On Sep 27, 1:13 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Are you sure you are using 0.17.7? it basically means that a response  
> > > was  
> > > sent twice on the same open channel, which should not happen.
> > > 
> > > On Tue, Sep 27, 2011 at 12:51 PM, pcdinh [pcd...@gmail.com](mailto:pcd...@gmail.com) wrote:
> > > 
> > > > Hi,
> > > 
> > > > I got a lot of exceptions in the log file
> > > 
> > > > [2011-09-27 08:39:56,940][WARN][http.netty]  
> > > > [Professor X]  
> > > > Caught exception while handling client http traffic, closing  
> > > > connection  
> > > > java.lang.IllegalStateException: cannot send more responses than  
> > > > requests  
> > > > at
> > 
> > org.elasticsearch.common.netty.handler.codec.http.HttpContentEncoder.writeR  
> > equested(HttpContentEncoder.java:102)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.common.netty.channel.SimpleChannelHandler.handleDownstrea  
> > m(SimpleChannelHandler.java:266)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstrea  
> > m(DefaultChannelPipeline.java:591)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendDownstrea  
> > m(DefaultChannelPipeline.java:582)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.common.netty.channel.Channels.write(Channels.java:611)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.common.netty.channel.Channels.write(Channels.java:578)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.common.netty.channel.AbstractChannel.write(AbstractChanne  
> > l.java:251)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.http.netty.NettyHttpChannel.sendResponse(NettyHttpChannel  
> > .java:156)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexA  
> > ction.java:123)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.rest.action.index.RestIndexAction$1.onResponse(RestIndexA  
> > ction.java:101)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.action.support.replication.TransportShardReplicationOpera  
> > tionAction$AsyncShardOperationAction.performReplicas(TransportShardReplicat  
> > ionOperationAction.java:493)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.action.support.replication.TransportShardReplicationOpera  
> > tionAction$AsyncShardOperationAction.performOnPrimary(TransportShardReplica  
> > tionOperationAction.java:465)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > 
> > org.elasticsearch.action.support.replication.TransportShardReplicationOpera  
> > tionAction$AsyncShardOperationAction$1.run(TransportShardReplicationOperati  
> > onAction.java:377)
> > 
> > > > ```
> > > > at
> > > > 
> > > > ```
> > > > 
> > > > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(.java:886)  
> > > > at
> > 
> > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:  
> > 908)
> > 
> > > > ```
> > > > at java.lang.Thread.run(Thread.java:662)
> > > > 
> > > > ```
> > > 
> > > > Version in use: 0.17.7
> > > 
> > > > What does it mean?
> > > 
> > > > Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 3:47am UTC](https://discuss.elastic.co/t/elasticsearch-exception-java-lang-illegalstateexception-cannot-send-more-responses-than-requests/5461/6 "2017-07-06T03:47:56Z")

</div>


