https://bz.apache.org/bugzilla/show_bug.cgi?id=64944

            Bug ID: 64944
           Summary: Incorrect bytesSent metric when compression is enabled
           Product: Tomcat 9
           Version: 9.0.39
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: chen...@gmail.com
  Target Milestone: -----

I'm using Spring Boot 2.2.11 with Tomcat 9.0.39. I found when compression is
enabled, the bytesSent metric exposed by org.apache.coyote.RequestGroupInfo is
always 0. Those metrics are exposed in JMX as well.

I believe the issue is caused by
org.apache.coyote.http11.filters.GzipOutputFilter.doWrite(ByteBuffer)
implementation. It doesn't change the chunk parameter position in this code
branch:

    if (chunk.hasArray()) {
        compressionStream.write(chunk.array(), chunk.arrayOffset() + 
chunk.position(), len);
    } 

So org.apache.coyote.Response.doWrite(ByteBuffer) method will not be able to
update contentWritten correctly:

    contentWritten += len - chunk.remaining();

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to