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();
Thanks for the report and the analysis. Fixed in: - 10.0.x for 10.0.0-M11 onwards - 9.0.x for 9.0.41 onwards - 8.5.x for 8.5.61 onwards 7.0.x was not affected.