Skip to content

[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

Closed
@huibinliupush

Description

@huibinliupush
Contributor

SO_LINGERHalfClosureBug

as shown in the picture above。

when SO_LINGGER is used in the client side, and client call NioSocketChannel#shutdownOutput() to half close the tcp connection。

then server side OP_READ is active,server begin to shutdowninput and triger 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 the CLOSE_WAIT state.

Expected behavior

client in the FIN_WAIT2 state can read and process these data which is sended by server in the CLOSE_WAIT state.

Steps to reproduce

 ServerBootstrap server = new ServerBootstrap();
 server.childOption(ChannelOption.ALLOW_HALF_CLOSURE, true)

 Bootstrap client = new Bootstrap();
 client.option(ChannelOption.SO_LINGER, 1)

Minimal yet complete reproducer code (or URL to code)

see unit test method testHalfClosureReceiveDataOnFinalWait2StateWhenSoLingerSet

Netty version

4.1.72.Final

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @normanmaurer@huibinliupush

        Issue actions

          [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 · Issue #11981 · netty/netty