grizzly
  1. grizzly
  2. GRIZZLY-1551

Enabling compression leads to only 10 Bytes being sent for files of 8193 up to 16383 Bytes

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.3, 2.3.4, 3.0
    • Fix Version/s: 2.3.4, 2.3.5, 3.0
    • Component/s: framework
    • Labels:
      None
    • Environment:

      Windows 7 64 Bit

      Description

      When HTTP compression is enabled, files that have a size of more than 16384 Bytes will often be truncated to 16384 Bytes. When the file cache is enabled, this only happens on the first access, if it is disabled, the truncation happens always.

      The problem can be reproduced using this code snippet:

      public class GrizzlyTest
      {
          public static void main(String[] args) throws IOException
          {
              HttpServer server = HttpServer.createSimpleServer();
      
              NetworkListener listener = server.getListener("grizzly");
              listener.getFileCache().setEnabled(false);
              listener.setCompression("on");
      
              server.start();
      
              System.in.read();
          }
      }
      

        Activity

        Hide
        Jonas Thedering added a comment -

        Sorry, I wanted to edit the issue but can't find out how to do that. The sample code in the description is still correct, but the issue has changed in that for files that are smaller than 16384 bytes and larger than 8192 bytes only 10 bytes of encoded data are sent.

        The following code produces a text file that can be used to reproduce the issue:

        public class FileGenerator
        {
            public static void main(String[] args) throws IOException
            {
                FileWriter fw = new FileWriter("test2.txt");
                StringBuilder sb = new StringBuilder(10);
                sb.append("..........");
                for ( int i = 0; i < 820; i++ )
                {
                    String number = String.valueOf(i * 10);
                    sb.replace(0, number.length(), number);
        
                    fw.append(sb);
                }
        
                fw.close();
            }
        }
        
        Show
        Jonas Thedering added a comment - Sorry, I wanted to edit the issue but can't find out how to do that. The sample code in the description is still correct, but the issue has changed in that for files that are smaller than 16384 bytes and larger than 8192 bytes only 10 bytes of encoded data are sent. The following code produces a text file that can be used to reproduce the issue: public class FileGenerator { public static void main( String [] args) throws IOException { FileWriter fw = new FileWriter( "test2.txt" ); StringBuilder sb = new StringBuilder(10); sb.append( ".........." ); for ( int i = 0; i < 820; i++ ) { String number = String .valueOf(i * 10); sb.replace(0, number.length(), number); fw.append(sb); } fw.close(); } }
        Hide
        oleksiys added a comment -

        Hi,

        can you pls. try Grizzly 2.3.5-SNAPSHOT?

        Thanks!

        Show
        oleksiys added a comment - Hi, can you pls. try Grizzly 2.3.5-SNAPSHOT? Thanks!
        Hide
        Jonas Thedering added a comment -

        Yesterday I tried the Grizzly 2.3.5-SNAPSHOT and the problem was the same as in 2.3.4, but with today's snapshot the problem is fixed. I hope there are no regressions as in the fix for the previous issue.

        Show
        Jonas Thedering added a comment - Yesterday I tried the Grizzly 2.3.5-SNAPSHOT and the problem was the same as in 2.3.4, but with today's snapshot the problem is fixed. I hope there are no regressions as in the fix for the previous issue.
        Hide
        oleksiys added a comment -

        we didn't touch the fix for the prev. issue, so it should be fine.
        thank you for confirming!

        Show
        oleksiys added a comment - we didn't touch the fix for the prev. issue, so it should be fine. thank you for confirming!
        Hide
        oleksiys added a comment -

        fixed

        [2.3.x]
        Revision: 53ca801c56f7e9af0d71d624cc155bf7df6466cd
        Date: 2013-07-25 00:17:46 UTC

        [master]
        Revision: 4605ef1c550d65debbafdfca96a058e0c6edc932
        Date: 2013-07-25 00:17:46 UTC

        Log Message:
        ------------
        + fix issue #1551
        https://java.net/jira/browse/GRIZZLY-1551
        "Enabling compression leads to only 10 Bytes being sent for files of 8193 up to 16383 Bytes"

        Show
        oleksiys added a comment - fixed [2.3.x] Revision: 53ca801c56f7e9af0d71d624cc155bf7df6466cd Date: 2013-07-25 00:17:46 UTC [master] Revision: 4605ef1c550d65debbafdfca96a058e0c6edc932 Date: 2013-07-25 00:17:46 UTC Log Message: ------------ + fix issue #1551 https://java.net/jira/browse/GRIZZLY-1551 "Enabling compression leads to only 10 Bytes being sent for files of 8193 up to 16383 Bytes"

          People

          • Assignee:
            oleksiys
            Reporter:
            Jonas Thedering
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: