Skip to content

Quic: CONNECTION_CLOSE frame dropped when close() cancels pending SENDMSG on io_uring #16718

@tsegismont

Description

@tsegismont

Not sure if this is an issue or a known limitation, anyway here's a problem I found while testing Vert.x core main branch with io_uring (Netty 4.2.12.Final)

We had some test failures in our QuickServerTest and Http3ServerTest close/shutdown tests because not all clients received a notification of connection being closed by the server.

The failure goes away by deferring UDP channel close in Vert.x io.vertx.core.net.impl.quic.QuicEndpointImpl:

this.connectionGroup = new ConnectionGroup(channel.eventLoop()) {
@Override
protected void handleClose(Completable<Void> completion) {
Channel ch = channel;
        // Defer close to allow io_uring (if used) to complete pending SENDMSG for CONNECTION_CLOSE
        ch.eventLoop().schedule(() -> {
          ch.close().addListener((ChannelFutureListener) future -> {
            synchronized (QuicEndpointImpl.this) {
              context = null;
            }
          }).addListener((ChannelFutureListener) future -> {
            try {
              closeHook();
            } finally {
              completion.succeed();
            }
          });
        }, 0, TimeUnit.MILLISECONDS);
}
};

I think the issue is that flush() and close() are called on the datagram channel within the same event loop iteration, so the SENDMSG SQE submitted by flush() is cancelled by close() before the kernel processes it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions