glassfish
  1. glassfish
  2. GLASSFISH-20239

IllegalStateException if the async thread completed before the servlet thread

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0_dev
    • Component/s: web_container
    • Labels:
      None

      Description

        An exception or error occurred in the container during the request processing
      java.lang.IllegalStateException: Internal org.glassfish.grizzly.http.server.Response has not been set
      	at org.glassfish.grizzly.http.server.Response.checkResponse(Response.java:1840)
      	at org.glassfish.grizzly.http.server.Response.getStatus(Response.java:968)
      	at org.apache.catalina.connector.Response.getStatus(Response.java:1070)
      	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:364)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      	at java.lang.Thread.run(Thread.java:722)
      
      import java.io.*;
      import javax.servlet.*;
      import javax.servlet.annotation.*;
      import javax.servlet.http.*;
      
      @WebServlet(urlPatterns = {"/foo"}, asyncSupported=true)
      public class MyServlet extends HttpServlet {
          @Override
          protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              System.out.println("MyServlet");
      
              final AsyncContext asyncContext = req.startAsync();
              new Thread() {
                  @Override
                  public void run() {
                          asyncContext.complete();
                  }
              }.start();
      
              try {
                  Thread.sleep(5000);
              } catch (InterruptedException e) {
                  //
              }
      
              System.out.println("MyServlet - leaving");
          }
      }
      

        Activity

        Hide
        Shing Wai Chan added a comment -

        The actual async complete should be delay until the servlet is completed in this case.
        Similar issue is identified for async dispatch.

        Show
        Shing Wai Chan added a comment - The actual async complete should be delay until the servlet is completed in this case. Similar issue is identified for async dispatch.
        Hide
        Shing Wai Chan added a comment -

        According to Servlet spec, the async complete should not take effect at that point.

        • What is the impact on the customer of the bug?
          The bug does not comform to the Servlet 3.1 spec.
        • What is the cost/risk of fixing the bug?
          Two java files change.
        • Is there an impact on documentation or message strings?
          No.
        • Which tests should QA (re)run to verify the fix did not destabilize GlassFish?
          SQE web tests
        • Which is the targeted build of 4.0 for this fix?
          4.0_b85
        • If this an integration of a new version of a component from another project,
          what are the changes that are being brought in? This might be list of
          Jira issues from that project or a list of revision messages.
          N/A
        Show
        Shing Wai Chan added a comment - According to Servlet spec, the async complete should not take effect at that point. What is the impact on the customer of the bug? The bug does not comform to the Servlet 3.1 spec. What is the cost/risk of fixing the bug? Two java files change. Is there an impact on documentation or message strings? No. Which tests should QA (re)run to verify the fix did not destabilize GlassFish? SQE web tests Which is the targeted build of 4.0 for this fix? 4.0_b85 If this an integration of a new version of a component from another project, what are the changes that are being brought in? This might be list of Jira issues from that project or a list of revision messages. N/A
        Hide
        Tom Mueller added a comment -

        Approved for 4.0.

        Show
        Tom Mueller added a comment - Approved for 4.0.
        Hide
        Shing Wai Chan added a comment -

        Sending web-core/src/main/java/org/apache/catalina/connector/AsyncContextImpl.java
        Sending web-core/src/main/java/org/apache/catalina/connector/Request.java
        Transmitting file data ..
        Committed revision 61411.

        Show
        Shing Wai Chan added a comment - Sending web-core/src/main/java/org/apache/catalina/connector/AsyncContextImpl.java Sending web-core/src/main/java/org/apache/catalina/connector/Request.java Transmitting file data .. Committed revision 61411.

          People

          • Assignee:
            Shing Wai Chan
            Reporter:
            Shing Wai Chan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: