Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixed a cyclical error when flushing an error and flushing fails. #126

Merged
merged 1 commit into from

3 participants

@hmottestad

Added a try catch around flushResponse() in error(Throwable error) which can cause cyclical errors where one error causes another because it fails when flushing.

Following is the stack trace for the expection:

org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more

@hmottestad hmottestad Update NettyHttpResponse.java
Added a try catch around flushResponse() in error(Throwable error) which can cause cyclical errors where one error causes another because it fails when flushing. 

Following is the stack trace for the expection:

org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
	at org.jboss.netty.channel.Channels.write(Channels.java:704)
	at org.jboss.netty.channel.Channels.write(Channels.java:671)
	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
	... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
	at org.jboss.netty.channel.Channels.write(Channels.java:704)
	at org.jboss.netty.channel.Channels.write(Channels.java:671)
	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
	... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
	at org.jboss.netty.channel.Channels.write(Channels.java:704)
	at org.jboss.netty.channel.Channels.write(Channels.java:671)
	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
	... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
	at org.jboss.netty.channel.Channels.write(Channels.java:704)
	at org.jboss.netty.channel.Channels.write(Channels.java:671)
	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
	... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
	at org.jboss.netty.channel.Channels.write(Channels.java:704)
	at org.jboss.netty.channel.Channels.write(Channels.java:671)
	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
	... 9 more
12438c0
@hmottestad

Bump.

@lostdj lostdj referenced this pull request from a commit in lostdj/webbit
@lostdj lostdj Merge branch 'hmottestad-webbit/master'
Webbit: Sync with upstream: Pull request "Fixed a cyclical error when flushing an error and flushing fails. #126".

Pull request details:

Added a try catch around flushResponse() in error(Throwable error) which can cause cyclical errors where one error causes another because it fails when flushing.

Following is the stack trace for the expection:

org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more
org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
Caused by: java.lang.IllegalStateException: cannot send more responses than requests
at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
at org.jboss.netty.channel.Channels.write(Channels.java:704)
at org.jboss.netty.channel.Channels.write(Channels.java:671)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
... 9 more
d1f6c55
@sharvie sharvie merged commit b7c45f3 into webbit:master

1 check passed

Details default The Travis CI build passed
@aslakhellesoy

@sharvie I see you're in :-)

@sharvie
Owner

I actually don't think this patch fixes the issue. Working on another solution now

@sharvie
Owner

I ended up reverting this pull request because it didn't solve the issue. I just committed a change that fixes it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 8, 2013
  1. @hmottestad

    Update NettyHttpResponse.java

    hmottestad authored
    Added a try catch around flushResponse() in error(Throwable error) which can cause cyclical errors where one error causes another because it fails when flushing. 
    
    Following is the stack trace for the expection:
    
    org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
    	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
    	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:637)
    Caused by: java.lang.IllegalStateException: cannot send more responses than requests
    	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
    	at org.jboss.netty.channel.Channels.write(Channels.java:704)
    	at org.jboss.netty.channel.Channels.write(Channels.java:671)
    	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
    	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
    	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
    	... 9 more
    org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
    	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
    	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:637)
    Caused by: java.lang.IllegalStateException: cannot send more responses than requests
    	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
    	at org.jboss.netty.channel.Channels.write(Channels.java:704)
    	at org.jboss.netty.channel.Channels.write(Channels.java:671)
    	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
    	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
    	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
    	... 9 more
    org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
    	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
    	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:637)
    Caused by: java.lang.IllegalStateException: cannot send more responses than requests
    	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
    	at org.jboss.netty.channel.Channels.write(Channels.java:704)
    	at org.jboss.netty.channel.Channels.write(Channels.java:671)
    	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
    	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
    	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
    	... 9 more
    org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
    	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
    	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:637)
    Caused by: java.lang.IllegalStateException: cannot send more responses than requests
    	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
    	at org.jboss.netty.channel.Channels.write(Channels.java:704)
    	at org.jboss.netty.channel.Channels.write(Channels.java:671)
    	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
    	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
    	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
    	... 9 more
    org.webbitserver.WebbitException: cannot send more responses than requests on [id: 0x4be70e4d, /10.0.0.1:57648 :> /10.0.0.99:1234]
    	at org.webbitserver.WebbitException.fromException(WebbitException.java:36)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:170)
    	at org.webbitserver.netty.NettyHttpChannelHandler$3.run(NettyHttpChannelHandler.java:94)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:637)
    Caused by: java.lang.IllegalStateException: cannot send more responses than requests
    	at org.jboss.netty.handler.codec.http.HttpContentEncoder.writeRequested(HttpContentEncoder.java:100)
    	at org.jboss.netty.channel.Channels.write(Channels.java:704)
    	at org.jboss.netty.channel.Channels.write(Channels.java:671)
    	at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
    	at org.webbitserver.netty.NettyHttpResponse.write(NettyHttpResponse.java:207)
    	at org.webbitserver.netty.NettyHttpResponse.flushResponse(NettyHttpResponse.java:195)
    	at org.webbitserver.netty.NettyHttpResponse.error(NettyHttpResponse.java:168)
    	... 9 more
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/main/java/org/webbitserver/netty/NettyHttpResponse.java
View
9 src/main/java/org/webbitserver/netty/NettyHttpResponse.java
@@ -166,8 +166,13 @@ public NettyHttpResponse error(Throwable error) {
String message = getStackTrace(error);
header("Content-Type", "text/plain");
content(message);
- flushResponse();
-
+ try{
+ flushResponse();
+ }catch (IllegalStateException e){
+ return null;
+ }catch (WebbitException e){
+ return null;
+ }
exceptionHandler.uncaughtException(Thread.currentThread(),
WebbitException.fromException(error, ctx.getChannel()));
Something went wrong with that request. Please try again.