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
[bug] when SO_LINGGER is used in the TCP half-closed scenario, the client in the fin_wait2 state cannot receive the data sent from the server which is in the close_wait state #11981
Milestone
Comments
normanmaurer
added a commit
that referenced
this issue
Jan 11, 2022
…rt TCP half-closure in fin_wait2 state can still receive and process the data which is send by another side in the close_wait state (#11982) Motivation: we can not call `doDeregister` to cancel the key of the channel from the selector in the `io.netty.channel.AbstractChannel.AbstractUnsafe#shutdownOutput(io.netty.channel.ChannelPromise, java.lang.Throwable)` method。 - because we should ensure the side which enbale `SO_LINGER` and call `showdownOutput` to start TCP half-closure in fin_wait2 state can still receive and process the data which is send by another side in the close_wait state。 - and the shutdown function does not block regardless of the SO_LINGER setting on the socket,so we don't need to use GlobalEventExecutor to execute the shutdown Modification: In summary there is no need to call `prepareToClose()` in the `AbstractChannel.AbstractUnsafe#shutdownOutput` method Result: Fixes issue #11981 client in the FIN_WAIT2 state can read and process these data which is sended by server in the CLOSE_WAIT state,when SO_LINGGER is used in the TCP half-closed scenario Co-authored-by: Norman Maurer <norman_maurer@apple.com>
normanmaurer
added a commit
that referenced
this issue
Jan 11, 2022
…rt TCP half-closure in fin_wait2 state can still receive and process the data which is send by another side in the close_wait state (#11982) Motivation: we can not call `doDeregister` to cancel the key of the channel from the selector in the `io.netty.channel.AbstractChannel.AbstractUnsafe#shutdownOutput(io.netty.channel.ChannelPromise, java.lang.Throwable)` method。 - because we should ensure the side which enbale `SO_LINGER` and call `showdownOutput` to start TCP half-closure in fin_wait2 state can still receive and process the data which is send by another side in the close_wait state。 - and the shutdown function does not block regardless of the SO_LINGER setting on the socket,so we don't need to use GlobalEventExecutor to execute the shutdown Modification: In summary there is no need to call `prepareToClose()` in the `AbstractChannel.AbstractUnsafe#shutdownOutput` method Result: Fixes issue #11981 client in the FIN_WAIT2 state can read and process these data which is sended by server in the CLOSE_WAIT state,when SO_LINGGER is used in the TCP half-closed scenario Co-authored-by: Norman Maurer <norman_maurer@apple.com>
10brothers
pushed a commit
to 10brothers/netty
that referenced
this issue
Jan 20, 2022
…rt TCP half-closure in fin_wait2 state can still receive and process the data which is send by another side in the close_wait state (netty#11982) Motivation: we can not call `doDeregister` to cancel the key of the channel from the selector in the `io.netty.channel.AbstractChannel.AbstractUnsafe#shutdownOutput(io.netty.channel.ChannelPromise, java.lang.Throwable)` method。 - because we should ensure the side which enbale `SO_LINGER` and call `showdownOutput` to start TCP half-closure in fin_wait2 state can still receive and process the data which is send by another side in the close_wait state。 - and the shutdown function does not block regardless of the SO_LINGER setting on the socket,so we don't need to use GlobalEventExecutor to execute the shutdown Modification: In summary there is no need to call `prepareToClose()` in the `AbstractChannel.AbstractUnsafe#shutdownOutput` method Result: Fixes issue netty#11981 client in the FIN_WAIT2 state can read and process these data which is sended by server in the CLOSE_WAIT state,when SO_LINGGER is used in the TCP half-closed scenario Co-authored-by: Norman Maurer <norman_maurer@apple.com>
raidyue
pushed a commit
to raidyue/netty
that referenced
this issue
Jul 8, 2022
…rt TCP half-closure in fin_wait2 state can still receive and process the data which is send by another side in the close_wait state (netty#11982) Motivation: we can not call `doDeregister` to cancel the key of the channel from the selector in the `io.netty.channel.AbstractChannel.AbstractUnsafe#shutdownOutput(io.netty.channel.ChannelPromise, java.lang.Throwable)` method。 - because we should ensure the side which enbale `SO_LINGER` and call `showdownOutput` to start TCP half-closure in fin_wait2 state can still receive and process the data which is send by another side in the close_wait state。 - and the shutdown function does not block regardless of the SO_LINGER setting on the socket,so we don't need to use GlobalEventExecutor to execute the shutdown Modification: In summary there is no need to call `prepareToClose()` in the `AbstractChannel.AbstractUnsafe#shutdownOutput` method Result: Fixes issue netty#11981 client in the FIN_WAIT2 state can read and process these data which is sended by server in the CLOSE_WAIT state,when SO_LINGGER is used in the TCP half-closed scenario Co-authored-by: Norman Maurer <norman_maurer@apple.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
as shown in the picture above。
when
SO_LINGGER
is used in the client side, and client callNioSocketChannel#shutdownOutput()
to half close the tcp connection。then server side
OP_READ
is active,server begin toshutdowninput
andtriger ChannelInputShutdownEvent
,next send some data to client in the process handler of the ChannelInputShutdownEvent event。Actual behavior
client in the
FIN_WAIT2
state can not read and process these data which is sended by server in theCLOSE_WAIT
state.Expected behavior
client in the
FIN_WAIT2
state can read and process these data which is sended by server in theCLOSE_WAIT
state.Steps to reproduce
Minimal yet complete reproducer code (or URL to code)
see unit test method testHalfClosureReceiveDataOnFinalWait2StateWhenSoLingerSet
Netty version
4.1.72.Final
The text was updated successfully, but these errors were encountered: