Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-2986

IllegalStateException in CamelContinuationServlet under heavy load

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.0
    • 2.5.0
    • camel-jetty
    • None

    Description

      Reason is a race between continuation.suspend() and continuation.resume(). It can occur that continuation.resume() is executed before continuation.suspend() leading to an IllegalStateException thrown by Jetty:

      java.lang.IllegalStateException: DISPATCHED,initial
          at org.eclipse.jetty.server.AsyncContinuation.dispatch(AsyncContinuation.java:364)
          at org.eclipse.jetty.server.AsyncContinuation.resume(AsyncContinuation.java:769)
          at org.apache.camel.component.jetty.CamelContinuationServlet$1.done(CamelContinuationServlet.java:85)
          at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:78)
          at org.apache.camel.processor.UnitOfWorkProcessor$1.done(UnitOfWorkProcessor.java:104)
          at org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:262)
          at org.apache.camel.processor.RedeliveryErrorHandler$1.done(RedeliveryErrorHandler.java:302)
          at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:78)
          at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:78)
      

      This is the case when an async completion callback is faster than the thread that is concurrently executing the if (continuation.isInitial()) block.

      I'll commit a fix soon that also follows the recommendations in http://wiki.eclipse.org/Jetty/Feature/Continuations to always call continuation.suspend() before registering the continuation with a callback handler.

      Attachments

        Activity

          People

            mrt1nz Martin Krasser
            mrt1nz Martin Krasser
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: