Description
This is a follow on to #5753
Even with the fix for that applied, our app sometimes ends up hanging after a particular nioEventLoopGroup thread goes into an infinite loop. In this case, the call from io.netty.handler.stream.ChunkedWriteHandler.doFlush goes into org.glassfish.jersey.netty.connector.internal.JerseyChunkedInput.readChunk() (instead of write()) but the effect is the same: there is a timeout on the queue.poll() call, control returns to the doFlush() method, but because the stream is still writable, the doFlush() method continues to call readChunk().
We have not been able to get a simple reproducer for this test case as we were for the other, but it's clear that the code is not honoring the READ_TIMEOUT here if it returns Unpooled.EMPTY_BUFFER when the queue.poll() call times out. I would assume that we should again throw an IOException() here for the timeout.