jersey
  1. jersey
  2. JERSEY-1647

It seems that GZIP compression relies on the finalize() method of the Deflater

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-rc2, 2.0
    • Component/s: None
    • Labels:
      None

      Description

      We encountered java.lang.OutOfMemoryError
      at java.util.zip.Deflater.init(Native Method)
      at java.util.zip.Deflater.<init>(Deflater.java:169)
      at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:91)
      at java.util.zip.GZIPOutputStream.<init>(GZIPOutputStream.java:110)
      at com.sun.jersey.api.container.filter.GZIPContentEncodingFilter$Adapter.writeStatusAndHeaders(GZIPContentEncodingFilter.java:107)
      ...

      It seems that the GZIPOutputStream/DeflaterOutputStream#close() gets never called from Jersey which prevents the Deflater from releasing its memory. It will only be called from the finalizer. And this may be not fast enough!?

        Issue Links

          Activity

          Hide
          Marek Potociar added a comment - - edited

          Please verify that the issue is fixed as part of JERSEY-1760 and close if fixed.

          Show
          Marek Potociar added a comment - - edited Please verify that the issue is fixed as part of JERSEY-1760 and close if fixed.
          Hide
          da152 added a comment -

          I am confused why you changed the fix version from rc1 to rc2. Are you saying that there is a doubt that this will be fixed in 2.0 ?

          Show
          da152 added a comment - I am confused why you changed the fix version from rc1 to rc2. Are you saying that there is a doubt that this will be fixed in 2.0 ?
          Hide
          Pavel Bucek added a comment -

          no, we just released Jersey 2.0-rc1. This is still being considered for Jersey 2.0 (no guarantees though).

          Show
          Pavel Bucek added a comment - no, we just released Jersey 2.0-rc1. This is still being considered for Jersey 2.0 (no guarantees though).
          Hide
          Miroslav Fuksa added a comment -

          This was already fixed by JERSEY-1760. I have added a jersey e2e test.

          Details
          We close the latest stream wrapper. In the case of no interceptors it is the latest stream set by ContainerResponseContext#setEntityStream. In the case that any interceptor wraps the output stream then we close the stream which is set by WriterInterceptorContext#setOuptutStream as the last one. Therefore it is important that each such a stream correctly implements the close() and flush() method (especially the close() method must delegate the close() call to the wrapped output stream).

          Show
          Miroslav Fuksa added a comment - This was already fixed by JERSEY-1760 . I have added a jersey e2e test. Details We close the latest stream wrapper. In the case of no interceptors it is the latest stream set by ContainerResponseContext#setEntityStream. In the case that any interceptor wraps the output stream then we close the stream which is set by WriterInterceptorContext#setOuptutStream as the last one. Therefore it is important that each such a stream correctly implements the close() and flush() method (especially the close() method must delegate the close() call to the wrapped output stream).
          Hide
          Miroslav Fuksa added a comment -

          I am closing the issue as it was already fixed as a part of JERSEY-1760. Tests were added. Please see the comments of this issue.

          Show
          Miroslav Fuksa added a comment - I am closing the issue as it was already fixed as a part of JERSEY-1760 . Tests were added. Please see the comments of this issue.
          Hide
          Miroslav Fuksa added a comment -

          This bug was Closed but should be Resolved.

          Show
          Miroslav Fuksa added a comment - This bug was Closed but should be Resolved.

            People

            • Assignee:
              Miroslav Fuksa
              Reporter:
              liebig
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 3 hours
                3h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours Time Not Required
                2h