GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Quic: CONNECTION_CLOSE frame dropped when close() cancels pending SENDMSG on io_uring · Issue #16718 · netty/netty

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

New issue
Copy link
New issue
Copy link
Closed
#16758
Closed
Quic: CONNECTION_CLOSE frame dropped when close() cancels pending SENDMSG on io_uring#16718
#16758
Copy link
Milestone
4.2.14.Final

Description

@tsegismont
tsegismont
opened on Apr 28, 2026
Issue body actions

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.

Activity

  1. normanmaurer commented on Apr 30, 2026

    @normanmaurer
    normanmaurer
    on Apr 30, 2026
    Member
    More actions

    @tsegismont are you sure that you wait for the write promise to be notified before you call close() ? If this is the case it should work. There is no guarantee that the write really happened until the future of the write is completed and so it is expected that the close might race.

  2. tsegismont commented on Apr 30, 2026

    @tsegismont
    tsegismont
    on Apr 30, 2026
    ContributorAuthor
    More actions

    @normanmaurer I think so.

    First, in all Vert.x QuicConnectionImpl, we close Netty QuicChannel:

    https://github.com/eclipse-vertx/vert.x/blob/c13442b27b78ac3c768e9eecaedebb0123ffefad/vertx-core/src/main/java/io/vertx/core/net/impl/quic/QuicConnectionImpl.java#L109-L115

          @Override
          protected void handleClose(Completable<Void> completion) {
            BufferInternal reason = (BufferInternal) closePayload.getReason();
            ChannelFuture future = channel.close(false, closePayload.getError(), reason != null ? reason.getByteBuf() : Unpooled.EMPTY_BUFFER);
            PromiseInternal<Void> promise = (PromiseInternal<Void>) completion;
            future.addListener(promise);
          }

    The ChannelFuture returned by io.netty.handler.codec.quic.QuicChannel#close(boolean, int, io.netty.buffer.ByteBuf) is used to determine if the channel is effectively closed (close connection frames sent to the wire).

    When all active connections of a server are closed, we close the datagram channel in QuicEndpointImpl:

    https://github.com/eclipse-vertx/vert.x/blob/90938c545dc030e3e76a4464d76b764c0d8847f4/vertx-core/src/main/java/io/vertx/core/net/impl/quic/QuicEndpointImpl.java#L184-L201

    Not copy/pasting lines again because it's the same snippet as in the issue description.

    I think that the problem is the ChannelFuture returned by io.netty.handler.codec.quic.QuicChannel#close(boolean, int, io.netty.buffer.ByteBuf) is completed before the close connection frames sent to the wire.

    While debugging, I found the event loop thread enters io.netty.handler.codec.quic.QuicheQuicChannel#doClose. In this method, Quiche is invoked to prepare connection closing:

                int res = Quiche.quiche_conn_close(conn.address(), app, err,
                        Quiche.readerMemoryAddress(reason), reason.readableBytes());
                if (res < 0 && res != Quiche.QUICHE_ERR_DONE) {
                    throw Quiche.convertToException(res);
                }
                // As we called quiche_conn_close(...) we need to ensure we will call quiche_conn_send(...) either
                // now or we will do so once we see the channelReadComplete event.
                //
                // See https://docs.rs/quiche/0.6.0/quiche/struct.Connection.html#method.close
                if (connectionSend(conn) == SendResult.SOME) {
                    sendResult = SendResult.SOME;
                }

    I think the quiche_conn_close method generates the connection close frames but I admit I haven't verified this.

    Then later in io.netty.handler.codec.quic.QuicheQuicChannel#doClose Netty invokes io.netty.handler.codec.quic.QuicheQuicChannel#forceFlushParent :

                    if (sendResult == SendResult.SOME) {
                        // As this is the close let us flush it asap.
                        forceFlushParent();
                    } else {
                        flushParent();
                    }

    I think what happens here with io_uring is that an entry is put in the submission queue but that's it.

    Then in io.netty.channel.AbstractChannel.AbstractUnsafe#doClose0 Netty marks the close promise as succeeded, and Vert.x thinks the connection close frames have been sent to the wire.

    Admittedly, I'm new to both Quic and io_uring, so this could be all wrong 😅

  3. tsegismont commented on May 4, 2026

    @tsegismont
    tsegismont
    on May 4, 2026
    ContributorAuthor
    More actions

    @normanmaurer I put together this test as a reproducer: tsegismont@3f47fc5

    The test fails but if you enable the workaround:

    tsegismont@3f47fc5#diff-da6909d28d753831f45b8b109e026017c5baf52d2cc91dd995aa1c1c6d8c1dafR1944-R1945

    Then it passes.

    Does the reproducer look good to you?

  4. normanmaurer commented on May 5, 2026

    @normanmaurer
    normanmaurer
    on May 5, 2026
    Member
    More actions

    @tsegismont will check soonish... thanks!

    Reacted by Thomas Segismont
  5. tsegismont
    added a commit that references this issue on May 5, 2026

    Skip Quic/HTTP3 shutdown tests

    a8c976b
  6. normanmaurer
    added this to the 4.2.14.Final milestone on May 6, 2026
  7. normanmaurer commented on May 6, 2026

    @normanmaurer
    normanmaurer
    on May 6, 2026
    Member
    More actions

    @tsegismont thanks a lot for the reproducer... here is the fix #16758. I could also simulate the same problem with epoll / nio after I did understand what is going on. So no need to test with io_uring

  8. normanmaurer
    added a commit that references this issue on May 7, 2026

    Quic: Ensure writes are done before notify close promise of QuicheQui… (

    a555457
  9. normanmaurer
    closed this as completedin #16758on May 7, 2026
  10. tsegismont
    added 2 commits that reference this issue on May 7, 2026

    Skip Quic/HTTP3 shutdown tests

    4e05162

    Skip Quic/HTTP3 shutdown tests

    4a6580e
  11. normanmaurer
    added a commit that references this issue on May 10, 2026

    Quic: Ensure writes are done before notify close promise of QuicheQui… (

    d810e99
  12. tsegismont
    added a commit that references this issue on May 11, 2026

    Enable io_uring testing in CI (#5633)

    3924e93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      • 4.2.14.Final

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.