Jetty
  1. Jetty
  2. JETTY-485

GzipFilter disabled when use NIO RetryContinuation.suspend() in Comet application

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 6.1.5
    • Fix Version/s: None
    • Component/s: Servlet
    • Labels:
      None
    • Environment:
      JDK1.5.12, Jetty6.15
    • Number of attachments :
      0

      Description

      Source of GzipFilter.java:
      -----------------------------------------------------------------line 127------------------------------------------------
      GZIPResponseWrapper wrappedResponse=newGZIPResponseWrapper(request,response);

      boolean exceptional=true;
      try

      { super.doFilter(request,wrappedResponse,chain); exceptional=false; }

      finally
      {
      if (exceptional && !response.isCommitted())

      { wrappedResponse.resetBuffer(); wrappedResponse.noGzip(); }

      else
      wrappedResponse.finish();
      }
      -------------------------------------------------------------------------------
      When suspend RetryContinuation, throw a RetryRequest RuntimeException.The exceptional of GzipFilter will be "true".
      So, " wrappedResponse.noGzip();" always invoked. When we resume the Continuation and write out content, the GzipFilter already disabled.

        Activity

        Hide
        Greg Wilkins added a comment -

        The noGzip does not persist to the retry?

        If you run the standard jetty test webapp and hit:

        http://localhost:8080/test/dump/info?continue=1000

        you will see that the response is gzipped AFTER a suspend of 1000 ms.

        So there must be something else about your response that means it does not get compressed.
        Is it above minimum size?

        Show
        Greg Wilkins added a comment - The noGzip does not persist to the retry? If you run the standard jetty test webapp and hit: http://localhost:8080/test/dump/info?continue=1000 you will see that the response is gzipped AFTER a suspend of 1000 ms. So there must be something else about your response that means it does not get compressed. Is it above minimum size?
        Greg Wilkins made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Cannot Reproduce [ 5 ]
        Hide
        Andy Luan added a comment -

        I found the issue.
        The RetryContinuation cause twice HttpServlet.doGet() or doPost() invoke. In my case:
        1\ Keep the HttpServletResponse object reference when first doPost() method invoked.
        2\After RetryContinuation,suspend(), the GzipFilter object invoke noGzip()
        3\When RetryContinuation,resume(), the second doPost() method invoked.
        4\HttpServletResponse object is differ with the first, but HttpServeltRequest object is the same with the first.
        5\When use getWriter() of the first HttpServletResponse object to writeout response conent. The GzFilter object also is the
        old object which service by first HttpServeltResponse.So , no gzip and no error throw.
        6\Use the HttpServletResponse object of local method parameter, allthing is ok.

        Show
        Andy Luan added a comment - I found the issue . The RetryContinuation cause twice HttpServlet.doGet() or doPost() invoke. In my case: 1\ Keep the HttpServletResponse object reference when first doPost() method invoked. 2\After RetryContinuation,suspend(), the GzipFilter object invoke noGzip() 3\When RetryContinuation,resume(), the second doPost() method invoked. 4\HttpServletResponse object is differ with the first, but HttpServeltRequest object is the same with the first. 5\When use getWriter() of the first HttpServletResponse object to writeout response conent. The GzFilter object also is the old object which service by first HttpServeltResponse.So , no gzip and no error throw. 6\Use the HttpServletResponse object of local method parameter, allthing is ok.

          People

          • Assignee:
            Unassigned
            Reporter:
            Andy Luan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: