-
-
Notifications
You must be signed in to change notification settings - Fork 15.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlushConsolidationHandler may suppress flushes by mistake #9931
Conversation
Can one of the admins verify this patch? |
@carryxyh can you add a unit test as well ? |
done. pls check.. |
assertEquals(1L, channel.readOutbound()); | ||
assertNull(channel.readOutbound()); | ||
|
||
channel.finish(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: assertFalse(channel.finish);
*/ | ||
@Test | ||
public void testResend() throws Exception { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove empty line
@netty-bot test this please |
@carryxyh please fix check style:
|
@netty-bot test this please |
@carryxyh thanks a lot! |
Motivation: When `consolidatedWhenNoReadInProgress` is true, `channel.writeAndFlush (data) .addListener (f-> channel.writeAndFlush (data2))` Will cause data2 to never be flushed. Because the flush operation will synchronously execute the `channel.writeAndFlush (data2))` in the `listener`, and at this time, since the current execution thread is still an `eventloop`(`executor.inEventLoop()` was true), all handlers will be executed synchronously. At this time, since `nextScheduledFlush` is still not null, the `flush` operation of `data2` will be ignored in `FlushConsolidationHandler#scheduleFlush`. Modification: - reset `nextScheduledFlush` before `ctx.flush` - use `ObjectUtil` to polish code Result: Fixes #9923
Motivation: When `consolidatedWhenNoReadInProgress` is true, `channel.writeAndFlush (data) .addListener (f-> channel.writeAndFlush (data2))` Will cause data2 to never be flushed. Because the flush operation will synchronously execute the `channel.writeAndFlush (data2))` in the `listener`, and at this time, since the current execution thread is still an `eventloop`(`executor.inEventLoop()` was true), all handlers will be executed synchronously. At this time, since `nextScheduledFlush` is still not null, the `flush` operation of `data2` will be ignored in `FlushConsolidationHandler#scheduleFlush`. Modification: - reset `nextScheduledFlush` before `ctx.flush` - use `ObjectUtil` to polish code Result: Fixes netty#9923
Motivation:
When
consolidatedWhenNoReadInProgress
is true,channel.writeAndFlush (data) .addListener (f-> channel.writeAndFlush (data2))
Will cause data2 to never be flushed.Because the flush operation will synchronously execute the
channel.writeAndFlush (data2))
in thelistener
, and at this time, since the current execution thread is still aneventloop
(executor.inEventLoop()
was true), all handlers will be executed synchronously. At this time, sincenextScheduledFlush
is still not null, theflush
operation ofdata2
will be ignored inFlushConsolidationHandler#scheduleFlush
.Modification:
nextScheduledFlush
beforectx.flush
ObjectUtil
to polish codeResult:
Fixes #9923