Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ceade95

Browse files
authored
Ensure flushes are not discarded by ChunkedWriteHandler for passed th… (#14248)
…rough messages Motivation: We need to ensure we not discard flushed for provious passed through messages as otherwise we might never notify the promise Modifications: Always call ctx.flush() after discarding queued messages because of inactive Channel Result: Fixes #14236
1 parent dc30c33 commit ceade95

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

handler/src/main/java/io/netty/handler/stream/ChunkedWriteHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ private void discard(Throwable cause) {
207207
private void doFlush(final ChannelHandlerContext ctx) {
208208
final Channel channel = ctx.channel();
209209
if (!channel.isActive()) {
210+
// Even after discarding all previous queued objects we should propagate the flush through
211+
// to ensure previous written objects via writeAndFlush(...) that were not queued will be flushed and
212+
// so eventually fail the promise.
210213
discard(null);
214+
ctx.flush();
211215
return;
212216
}
213217

0 commit comments

Comments
 (0)