Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-26127

[GSS](8.0.z) Predicates not applied correctly to gzip filters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 8.0 Update 2
    • 8.0.0.GA-CR1, 8.0.0.GA-CR2
    • Clustering, REST, Undertow
    • None

    Description

      I have configured EAP to compress response if the output is grated than 500 bytes:

      /subsystem=undertow/configuration=filter/gzip=gzipFilter:add()
      /subsystem=undertow/server=default-server/host=default-host/filter-ref=gzipFilter:add(predicate="not request-smaller-than(500)")
      

      I have following snippet of REST resource (deployment is attached)

      
      
      @Path("test")
      @ApplicationPath("rest")
      @Produces(MediaType.APPLICATION_JSON)
      @Consumes(MediaType.APPLICATION_JSON)
      public class DemoApplication extends Application {
      
          @GET
          @Path("short-class")
          public MyData shortClass() {
              return new MyData("ok");
          }
      
          @GET
          @Path("long")
          public MyData longContent() {
              return new MyData("long text".repeat(1000));
          }
      
          public static class MyData {
              private String data;
      
              public MyData(String data) {
                  this.setData(data);
              }
      
              public String getData() {
                  return data;
              }
      
              public MyData setData(String data) {
                  this.data = data;
                  return this;
              }
          }
      }
      }       
      

      I expect /rest/test/long produce compressed response and /test/test/short-class non-compressed. However, with 8.0.0.GA.CR2 (and CR1) it is compressed anyway (see Content-Length and Content-Encoding headers):

      $ curl -X GET -H 'Accept: */*' -H 'Accept-encoding: gzip' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/short-class'
      HTTP/1.1 200 OK
      Content-Encoding: gzip
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 33
      Date: Fri, 24 Nov 2023 21:58:40 GMT
      
      Warning: Binary output can mess up your terminal. Use "--output -" to tell 
      Warning: curl to output it to your terminal anyway, or consider "--output 
      Warning: <FILE>" to save to a file.
      
      $ curl -X GET -H 'Accept: */*' -H 'Accept-encoding: gzip' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/long'
      HTTP/1.1 200 OK
      Content-Encoding: gzip
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 77
      Date: Fri, 24 Nov 2023 21:58:44 GMT
      
      Warning: Binary output can mess up your terminal. Use "--output -" to tell 
      Warning: curl to output it to your terminal anyway, or consider "--output 
      Warning: <FILE>" to save to a file.
      
      

      On the other hand, with 8.0.0.Beta I get expected results:

      $ curl -X GET -H 'Accept: */*' -H 'Accept-encoding: gzip' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/short-class'
      HTTP/1.1 200 OK
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 13
      Date: Fri, 24 Nov 2023 22:01:12 GMT
      
      {"data":"ok"}
      
      $ curl -X GET -H 'Accept: */*' -H 'Accept-encoding: gzip' -i 'http://localhost:8080/gezip-demo-1.0-SNAPSHOT/rest/test/long'
      HTTP/1.1 200 OK
      Content-Encoding: gzip
      Connection: keep-alive
      Content-Type: application/json
      Content-Length: 77
      Date: Fri, 24 Nov 2023 22:01:15 GMT
      
      Warning: Binary output can mess up your terminal. Use "--output -" to tell 
      Warning: curl to output it to your terminal anyway, or consider "--output 
      Warning: <FILE>" to save to a file.
      
      

      To summarize: The changes introduced by WFLY-17372 inadvertently changes the way the gzip filters are created such that they no longer apply predicates correctly.

      Attachments

        1. eap8_beta_stacktrace.txt
          19 kB
        2. eap8_cr_stacktrace.txt
          17 kB
        3. gzip-demo.zip
          3 kB
        4. gzip-demo-eap74.zip
          3 kB
        5. helloworld.diff
          3 kB

        Issue Links

          Activity

            People

              pferraro@redhat.com Paul Ferraro
              istraka@redhat.com Ivan Straka
              Votes:
              0 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: