-
-
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
Native epoll transport should honor AUTO_READ flag #6173
Comments
may be you should use Epoll level trigger, default Epoll Mode is edge trigger, see this |
Setting LEVEL_TRIGGERED for bootstrap option EPOLL_MODE did not help. |
IIRC if we get a EPOLLRDHUP then we must read until we get a socket error for stream sockets [1] while in ET mode as we may not be notified of activity on that FD again. This may not be necessary in LT mode, and especially if NIO transport is still able to deliver all data. I will need to investigate more. |
Motivation: EpollRecvByteAllocatorHandle will read unconditionally if EPOLLRDHUP has been received. However we can just treat this the same was we do as data maybe pending in ET mode, and let LT mode notify us if we haven't read all data. Modifications: - EpollRecvByteAllocatorHandle should not always force a read just because EPOLLRDHUP has been received, but just treated as an indicator that there maybe more data to read in ET mode Result: Fixes netty#6173.
Motivation: EpollRecvByteAllocatorHandle will read unconditionally if EPOLLRDHUP has been received. However we can just treat this the same was we do as data maybe pending in ET mode, and let LT mode notify us if we haven't read all data. Modifications: - EpollRecvByteAllocatorHandle should not always force a read just because EPOLLRDHUP has been received, but just treated as an indicator that there maybe more data to read in ET mode Result: Fixes netty#6173.
Expected behavior
Data should only be read when requested, if AUTO_READ option is set to false
Actual behavior
When using Epoll transport, netty calls handler's channelRead0 without requesting read, even if AUTO_READ option is set to false. NIO Transport on the other hand works as expected.
This could be a problem if you are acting as a proxy.
Steps to reproduce
This is reproducible using small sized data I could reproduce it starting from 1 byte till 150k. Client must close connection as soon as done writing. Here are some settings I used.
4096 87380 6291456
4096 16384 4194304
This could help generating test data quickly:
cp some_large_file 10k_file
truncate -s 10240 10k_file
nc host port < 10k_file
Netty version
4.1.6.Final
JVM version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
OS version
Linux 4.8.15-300.fc25.x86_64
x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: