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
Currently the code does not check whether channel is writable before invoking ChannelHandlerContext.write(). Instead, it checks whether channel is writable after writing to it, and flushes the channel in case it's not writable.
In the case of writing fast and having slow receiver, flushing may not make a channel writable immediately. However, the code always writes incoming messages to the channel. Messages may pile up in the internal queue of netty, and worse, exhaust memory if the situation (writing fast and having slow receiver) never changes.
Expected Behavior
No out of memory error when having slow receivers.
Actual Behavior
Messages piles up in the internal queue of netty, and worse, exhausts memory if the situation (writing fast and having slow receiver) never changes
Steps to Reproduce
Possible Solution
Need to check whether channel is writable (buffer not full) before writing to it. In case it's not writable, discard new messages with an error.
Your Environment
Reactor version(s) used:0.8.9
Other relevant libraries versions (eg. netty, ...):rsocket-java
JVM version (javar -version):java version "1.8.0_101"
OS and version (eg uname -a):Darwin *** 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64
The text was updated successfully, but these errors were encountered:
You can emulate this by pausing (through debug) the receiver process while the sender continues writing messages. The sender will be out of memory eventually.
It's a pitfall warned by Norman Maurer (one of the core developers of Netty) here.
Currently the code does not check whether channel is writable before invoking ChannelHandlerContext.write(). Instead, it checks whether channel is writable after writing to it, and flushes the channel in case it's not writable.
In the case of writing fast and having slow receiver, flushing may not make a channel writable immediately. However, the code always writes incoming messages to the channel. Messages may pile up in the internal queue of netty, and worse, exhaust memory if the situation (writing fast and having slow receiver) never changes.
Expected Behavior
No out of memory error when having slow receivers.
Actual Behavior
Messages piles up in the internal queue of netty, and worse, exhausts memory if the situation (writing fast and having slow receiver) never changes
Steps to Reproduce
Possible Solution
Need to check whether channel is writable (buffer not full) before writing to it. In case it's not writable, discard new messages with an error.
Your Environment
netty
, ...):rsocket-javajavar -version
):java version "1.8.0_101"uname -a
):Darwin *** 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64The text was updated successfully, but these errors were encountered: