Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Async IO failed with IllegalStateException in HttpOutput

Just tried 9.3.0M2 in maven central, no luck. This time I added counter to see when it failed, i.e. how many bytes have been sent before it failed. It seems it could range anywhere from a few MB to a few hundreds of MB. And still, the cause could either be state=READY or state=UNREADY
I spent sometime trying to get a test case without using a bunch of dependencies in my project, but it didn't work...

Failed with state=READY
java.lang.RuntimeException: Bytes written so far: 320 MB
at org.example.transport.http.server.AsyncIOResponseHandler.onError(AsyncIOResponseHandler.java:55)
at org.eclipse.jetty.server.HttpOutput.run(HttpOutput.java:892)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1176)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:339)
at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:243)
at org.eclipse.jetty.server.HttpOutput$AsyncICB.onCompleteSuccess(HttpOutput.java:963)
at org.eclipse.jetty.server.HttpOutput$AsyncWrite.onCompleteSuccess(HttpOutput.java:1104)
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:318)
at org.eclipse.jetty.util.IteratingCallback.succeeded(IteratingCallback.java:358)
at org.eclipse.jetty.server.HttpConnection$SendCallback.onCompleteSuccess(HttpConnection.java:728)
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:318)
at org.eclipse.jetty.util.IteratingCallback.succeeded(IteratingCallback.java:358)
at org.eclipse.jetty.io.WriteFlusher$PendingState.complete(WriteFlusher.java:270)
at org.eclipse.jetty.io.WriteFlusher.completeWrite(WriteFlusher.java:383)
at org.eclipse.jetty.io.SelectChannelEndPoint$3.run(SelectChannelEndPoint.java:54)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceRun.produceAndRun(ExecuteProduceRun.java:191)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceRun.run(ExecuteProduceRun.java:126)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:641)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:559)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: state=READY
at org.eclipse.jetty.server.HttpOutput.run(HttpOutput.java:921)
... 18 more

Failed with state=UNREADY
java.lang.RuntimeException: Bytes written so far: 663 MB
atĀ org.example.transport.http.server.AsyncIOResponseHandler.onError(AsyncIOResponseHandler.java:55)
at org.eclipse.jetty.server.HttpOutput.run(HttpOutput.java:892)
at org.eclipse.jetty.server.handler.ContextHandler.handle(ContextHandler.java:1176)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:339)
at org.eclipse.jetty.server.HttpChannel.run(HttpChannel.java:243)
at org.eclipse.jetty.server.HttpOutput$AsyncICB.onCompleteSuccess(HttpOutput.java:963)
at org.eclipse.jetty.server.HttpOutput$AsyncWrite.onCompleteSuccess(HttpOutput.java:1104)
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:318)
at org.eclipse.jetty.util.IteratingCallback.succeeded(IteratingCallback.java:358)
at org.eclipse.jetty.server.HttpConnection$SendCallback.onCompleteSuccess(HttpConnection.java:728)
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:318)
at org.eclipse.jetty.util.IteratingCallback.succeeded(IteratingCallback.java:358)
at org.eclipse.jetty.io.WriteFlusher$PendingState.complete(WriteFlusher.java:270)
at org.eclipse.jetty.io.WriteFlusher.completeWrite(WriteFlusher.java:383)
at org.eclipse.jetty.io.SelectChannelEndPoint$3.run(SelectChannelEndPoint.java:54)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceRun.produceAndRun(ExecuteProduceRun.java:191)
at org.eclipse.jetty.util.thread.strategy.ExecuteProduceRun.run(ExecuteProduceRun.java:126)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:641)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:559)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: state=UNREADY
at org.eclipse.jetty.server.HttpOutput.run(HttpOutput.java:921)
... 18 more

On Tue, Apr 14, 2015 at 2:02 PM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
Michael,

On Tue, Apr 14, 2015 at 7:54 PM, Michael Aaron <maaaroooon@xxxxxxxxx> wrote:
> Hello,
>
> I have upgraded to jetty-all-9.2.10.v20150310, but the problem remains. What
> might be wrong? Does this exception mean usage error (my code attempting to
> write when isReady() is not true), or does this mean some internal problem
> of Jetty?

Two things:

1) can you replicate the issue with the latest (built from the master
branch) Jetty ?
2) can you put up a reproducible test case ?

About your code, the use of synchronized is not optimal for async I/O
usage (you really want to be lock free for async I/O).

Your code looks ok, but it's incomplete for us to give you a full
picture. We would need onWritePossible() and understand when doWrite()
is called.
What Joakim was referring to is one of the issue I mention in the
slides, but you are avoiding it by testing again _os.isReady() in the
while _expression_, so the buffer is not corrupted.

Could be a 9.2.x issue, that's why if you can test with 9.3.x (master
branch) will be great.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
http://intalio.com
Developer advice, training, services and support
from the Jetty & CometD experts.
Intalio, the modern way to build business applications.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top