You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In production env, we meet huge small request need to writeAndFlush, in order to avoid oom, reduce large memory to old area, and limit the network flow.
I both set System.setProperty("io.netty.eventLoop.maxPendingTasks", "2048"); and
bootstrap.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(8 * 1024 , 32 * 1024));
but I found that, someTime, when many request comes in a short time, channel.isWriteable() is always false, but after that even if no request, it it still Talse.
It should be True, but actually sometime it is False and never comeback.
Actual behavior
SomeTime channel.isWriteable() is False, and even when no more WriteAndFlushTask, channel.isWriteable() is still False.
Steps to reproduce
I review the source code.
when I call WriteAndFlush, netty will run in following steps.
new a WriteAndFlushTask, It will incrementPendingOutboundBytes.
if the task executed in eventLoop, It will decrementPendingOutboundBytes.
so, if all task are created and run, no problem happends.
but if I limit the taskQueue and when request count large than its capacity, some WriteAndFlushTask maybe init, but rejected by eventloop.
at this time, WriteBufferWaterMark's TOTAL_PENDING_SIZE_UPDATER leak happends.
my solution
only use writeBufferWatermark and check isWriteable or only limit the taskQueue but abandon check channel.isWriteable().
how about add a common check, if rejected Task is WriteTask / WriteAndFlushTask, will decrementPendingOutboundBytes avoid leak.
my now solution is new NioEventLoopGroup with custom RejectedExecutionHandler
Is my usage wrong, or if more grace way to handle this problem?
Netty version
4.1.29.Final
JVM version (e.g. java -version)
java8
OS version (e.g. uname -a)
linux_x86_64
The text was updated successfully, but these errors were encountered:
…ails.
Motivation:
Currently we may end up in the situation that we incremented the pending bytes before submitting the AbstractWriteTask but never decrement these again if the submitting of the task fails. This may result in incorrect watermark handling.
Modifications:
- Correctly decrement pending bytes if subimitting of task fails and also ensure we recycle it correctly.
- Add unit test.
Result:
Fixes#8343.
…ails. (#8349)
Motivation:
Currently we may end up in the situation that we incremented the pending bytes before submitting the AbstractWriteTask but never decrement these again if the submitting of the task fails. This may result in incorrect watermark handling.
Modifications:
- Correctly decrement pending bytes if subimitting of task fails and also ensure we recycle it correctly.
- Add unit test.
Result:
Fixes#8343.
Expected behavior
In production env, we meet huge small request need to writeAndFlush, in order to avoid oom, reduce large memory to old area, and limit the network flow.
I both set
System.setProperty("io.netty.eventLoop.maxPendingTasks", "2048");
andbootstrap.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(8 * 1024 , 32 * 1024));
but I found that, someTime, when many request comes in a short time, channel.isWriteable() is always false, but after that even if no request, it it still Talse.
It should be True, but actually sometime it is False and never comeback.
Actual behavior
SomeTime channel.isWriteable() is False, and even when no more WriteAndFlushTask, channel.isWriteable() is still False.
Steps to reproduce
I review the source code.
when I call WriteAndFlush, netty will run in following steps.
so, if all task are created and run, no problem happends.
but if I limit the taskQueue and when request count large than its capacity, some WriteAndFlushTask maybe init, but rejected by eventloop.
at this time, WriteBufferWaterMark's TOTAL_PENDING_SIZE_UPDATER leak happends.
my solution
only use writeBufferWatermark and check isWriteable or only limit the taskQueue but abandon check channel.isWriteable().
how about add a common check, if rejected Task is WriteTask / WriteAndFlushTask, will decrementPendingOutboundBytes avoid leak.
my now solution is new NioEventLoopGroup with custom RejectedExecutionHandler
Is my usage wrong, or if more grace way to handle this problem?
Netty version
4.1.29.Final
JVM version (e.g.
java -version
)java8
OS version (e.g.
uname -a
)linux_x86_64
The text was updated successfully, but these errors were encountered: