atom feed3 messages in org.codehaus.jetty.dev[jetty-dev] Sporadic java.lang.Illega...
FromSent OnAttachments
Vidar RamdalMar 11, 2011 1:19 am 
Vidar RamdalMar 14, 2011 3:39 am 
Vidar RamdalMar 15, 2011 2:58 am 
Subject:[jetty-dev] Sporadic java.lang.IllegalStateException: STATE!=START
From:Vidar Ramdal (vid@idium.no)
Date:Mar 11, 2011 1:19:47 am
List:org.codehaus.jetty.dev

We're seing a number of these stacktraces in our logs, with both Jetty 6.1.21 and 6.1.26: HTTP/1.1 21.02.2011 14:59:04.892 *WARN* [446583619@qtp-904935057-66] org.apache.felix.http.jetty handle failed (java.lang.IllegalStateException: STATE!=START) java.lang.IllegalStateException: STATE!=START at
org.mortbay.jetty.AbstractGenerator.setVersion(AbstractGenerator.java:319) at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:859) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405) at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

This is the full stacktrace, as you can see, the only code involved here is Jetty code. This happens on about 1% of the requests, and causes the request to fail with a 503.

We're only seeing this in production, and the problem seems to occur completely randomly, so we haven't ben able to debug the problem properly.

But we have added some debug output, and found that when this situation occurs, o.m.j.AbstractGenerator._state is not properly reset from the previous request on the same connection. This causes the if (_state != STATE_HEADER) test in setVersion to return false, thus throwing the IllegalStateException.

The previous request, however, has been returned correctly with a 200 OK.

Any ideas what could be the cause of AbstractGenerator._state not being reset, and should this be considered a bug in Jetty?