This standalone Maven project demonstrates the ChunkedWriteHandler queue-drain behavior difference between Netty
4.1.104.Final and 4.1.105.Final.
The test writes an HTTP response and content chunks through:
ChunkedWriteHandler -> HttpResponseEncoder -> DirectBufferingOutboundHandler
It intentionally does not call flush() until after all writes are queued.
- With Netty
4.1.104.Final, response bytes remain queued beforeflush(), so the test passes. - With Netty
4.1.105.Final, response bytes reach the downstream direct-buffer staging handler beforeflush(), so the test fails and reports staged bytes plus pooled direct-memory growth.
Run the test against Netty 4.1.104.Final:
mvn -q test -Dnetty.version=4.1.104.FinalExpected result: the test passes.
Run the same test against Netty 4.1.105.Final:
mvn -q test -Dnetty.version=4.1.105.FinalExpected result: the test fails before flush() with a message similar to:
response bytes reached downstream direct-buffer staging before flush;
pendingBytes=2097196, usedDirectMemoryBefore=0, usedDirectMemoryAfterWrites=2228224
Run the same test against several Netty versions:
for version in 4.1.104.Final 4.1.105.Final 4.1.110.Final 4.1.136.Final; do echo "### Netty ${version}" mvn -q test -Dnetty.version="${version}" echo done
Expected results:
4.1.104.Final: pass
4.1.105.Final: fail
4.1.110.Final: fail
4.1.136.Final: fail