netty5/transport/src/test/java/io/netty/channel
Norman Maurer f23e901c99 [#5028] Fix re-entrance issue with channelWritabilityChanged(...) and write(...)
Motivation:

When always triggered fireChannelWritabilityChanged() directly when the update the pending bytes in the ChannelOutboundBuffer was made from within the EventLoop. This is problematic as this can cause some re-entrance issue if the user has a custom ChannelOutboundHandler that does multiple writes from within the write(...) method and also has a handler that will intercept the channelWritabilityChanged event and trigger another write when the Channel is writable. This can also easily happen if the user just use a MessageToMessageEncoder subclass and triggers a write from channelWritabilityChanged().

Modification:

- Always invoke the fireChannelWritabilityChanged() later on the EventLoop.
- Only trigger the fireChannelWritabilityChanged() if the channel is still active.
- when write(...) is called from outside the EventLoop we only increase the pending bytes in the outbound buffer (so that Channel.isWritable() is updated directly) but not cause a fireChannelWritabilityChanged(). The fireChannelWritabilityChanged() is then triggered once the task is picked up by the EventLoop as usual.

Result:

No more re-entrance possible because of writes from within channelWritabilityChanged(...) method.
2016-12-05 10:24:19 +01:00
..
embedded ByteBuf Input Stream Reference Count Ownership 2016-11-14 16:29:55 -08:00
group Make EventExecutor.shutdownGracefully() return Future 2013-06-12 08:00:54 +09:00
local Use shaded dependency on JCTools instead of copy and paste 2016-06-10 13:19:45 +02:00
nio [#4805] Respect isAutoRead() once re-register Channel 2016-02-04 15:34:24 +01:00
oio More graceful registration failure 2013-12-21 18:08:58 +09:00
pool Clean-up unused imports 2016-09-30 09:08:50 +02:00
AbstractChannelTest.java Remove ChannelHandlerInvoker 2016-05-17 11:14:00 +02:00
AbstractEventLoopTest.java [#4241] Ensure NioEventLoopGroup.shutdownGracefully(...) with no quiet period shutdown as fast as expected. 2016-08-05 07:21:17 +02:00
BaseChannelTest.java Revert "[#5028] Fix re-entrance issue with channelWritabilityChanged(...) and write(...)" 2016-04-09 20:32:47 +02:00
ChannelInitializerTest.java Ensure correct ordering if a ChannelInitializer adds another ChannelInitializer 2016-08-03 07:50:46 +02:00
ChannelOptionTest.java Allow to get existing ChannelOption / AttributeKey from String 2015-02-18 09:29:37 +01:00
ChannelOutboundBufferTest.java [#5028] Fix re-entrance issue with channelWritabilityChanged(...) and write(...) 2016-12-05 10:24:19 +01:00
CoalescingBufferQueueTest.java Fixing spammy logging for CoalescingBufferQueueTest 2015-11-25 07:16:05 -08:00
CombinedChannelDuplexHandlerTest.java Remove ChannelHandlerInvoker 2016-05-17 11:14:00 +02:00
CompleteChannelFutureTest.java [#1065] Provide Future/Promise without channel reference 2013-03-07 07:21:37 +01:00
DefaultChannelIdTest.java ByteBuf Input Stream Reference Count Ownership 2016-11-14 16:29:55 -08:00
DefaultChannelPipelineTest.java Ensure ChannelHandler.handlerAdded(...) callback is executed directly when added from ChannelFutureListener added to the registration future. 2016-07-09 08:04:15 +02:00
FailedChannelFutureTest.java [#1065] Provide Future/Promise without channel reference 2013-03-07 07:21:37 +01:00
LoggingHandler.java Fix most inspector warnings 2014-07-02 19:55:07 +09:00
PendingWriteQueueTest.java Guard against re-entrance in PendingWriteQueue.removeAndWriteAll() 2016-08-18 07:13:19 +02:00
ReentrantChannelTest.java Revert "[#5028] Fix re-entrance issue with channelWritabilityChanged(...) and write(...)" 2016-04-09 20:32:47 +02:00
SingleThreadEventLoopTest.java SingleThreadEventLoopTest failures 2016-10-11 09:09:53 +02:00
SucceededChannelFutureTest.java [#1065] Provide Future/Promise without channel reference 2013-03-07 07:21:37 +01:00
ThreadPerChannelEventLoopGroupTest.java Add a EventLoopGroup.register(ChannelPromise) 2016-05-21 18:40:17 +02:00