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 — HTTP2 server occasionally sends SETTINGS ack as first frame · Issue #16142 · netty/netty

HTTP2 server occasionally sends SETTINGS ack as first frame #16142

New issue
Copy link
New issue
Copy link
Open
Open
HTTP2 server occasionally sends SETTINGS ack as first frame#16142
Copy link
Assignees
normanmaurer

Description

@DerGuteMoritz
DerGuteMoritz
opened on Jan 15, 2026
Issue body actions

Aleph's test suite occasionally flakes with the following error:

io.netty.handler.codec.http2.Http2Exception: First received frame was not SETTINGS. Hex dump for first 5 bytes: 0000000401

The error message is a bit misleading: It is in fact a SETTINGS frame but with the ACK bit set (see 8f33488 - maybe the error message could be improved here). I suspect that it's a race condition in which the server receives the client's initial SETTINGS frame before having sent its own and then immediately sends the ack frame. I've tried to construct a reproducer for this but was unsuccessful so far but wanted to share it already - maybe you can figure this out more quickly 🙏

Activity

  1. normanmaurer
    added a commit that references this issue on Jan 19, 2026

    Improve exception message when first HTTP2SettingsFrame has the ack f…

    24874a2
  2. normanmaurer commented on Jan 19, 2026

    @normanmaurer
    normanmaurer
    on Jan 19, 2026
    Member
    More actions

    @DerGuteMoritz are both, the server and the client, using netty ?

  3. DerGuteMoritz commented on Jan 19, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Jan 19, 2026
    Author
    More actions

    @normanmaurer Yep, both are Netty, still on 4.1.130 though.

  4. DerGuteMoritz commented on Jan 19, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Jan 19, 2026
    Author
    More actions

    Ah perhaps I should also mention that we're using Http2MultiplexHandler. If you need more details, let me know!

  5. DerGuteMoritz commented on Jan 19, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Jan 19, 2026
    Author
    More actions

    Another possibly relevant piece of info: This happens with TLSv1.3 - could Early Data be the culprit?

  6. DerGuteMoritz commented on Jan 19, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Jan 19, 2026
    Author
    More actions

    FWIW: I just switched the CI job which ran into this error around 80% of the time to use TLSv1.2 instead of TLSv1.3 and so far, it hasn't happened again. Will re-run it a few times now to further confirm (it runs around 1 hour, so this will take a while).

  7. DerGuteMoritz commented on Jan 19, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Jan 19, 2026
    Author
    More actions

    OK, seems I just got lucky. It happened again on the second run, so TLSv1.3 Early Data can be safely ruled out I'd say.

  8. normanmaurer
    added 4 commits that reference this issue on Jan 20, 2026

    Improve exception message when first HTTP2SettingsFrame has the ack f… (

    5272df4

    Improve exception message when first HTTP2SettingsFrame has the ack f… (

    c0f70dd

    Improve exception message when first HTTP2SettingsFrame has the ack f… (

    0ef1bb2

    Improve exception message when first HTTP2SettingsFrame has the ack f… (

    0ff9677
  9. normanmaurer
    self-assigned this
    on Jan 20, 2026
  10. normanmaurer
    added a commit that references this issue on Jan 21, 2026

    Improve exception message when first HTTP2SettingsFrame has the ack f… (

    b61697b
  11. normanmaurer commented on Feb 18, 2026

    @normanmaurer
    normanmaurer
    on Feb 18, 2026
    Member
    More actions

    I was not able to reproduce this yet :/

  12. normanmaurer commented on Mar 3, 2026

    @normanmaurer
    normanmaurer
    on Mar 3, 2026
    Member
    More actions

    @DerGuteMoritz maybe you have any more details I can use to reproduce it ?

  13. DerGuteMoritz commented on Mar 3, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Mar 3, 2026
    Author
    More actions

    Here's what the connection and stream channel pipelines look like:

    4407 tid=38 DEBUG http2 - server conn chan pipeline: DefaultChannelPipeline
    	Handlers:
    		channel-tracker: netty$channel_tracking_handler$reify__17514 (#4301250)
    		ssl-handler: SslHandler (#287745061)
    		apn-handler: ApnHandler (#978339122)
    		http2-frame-codec: Http2FrameCodec (#2004107349)
    		multiplex: Http2MultiplexHandler (#2050400456)
    		conn-ex-handler: common$add_exception_handler$reify__17810 (#1586836519)
    
    4438 tid=38 DEBUG http2 - server stream chan pipeline: AbstractHttp2StreamChannel$3
    	Handlers:
    		AlephChannelInitializer#0: AlephChannelInitializer (#219959979)
    		streamer: ChunkedWriteHandler (#579726404)
    		handler: http2$server_handler$reify__18454 (#626110278)
    

    AlephChannelInitializer is a pretty simple shim.

    Does anything jump out?

  14. DerGuteMoritz commented on Mar 16, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Mar 16, 2026
    Author
    More actions

    In the meantime, I received a patch which claims to work around the issue and contains a possible explanation for it. Quoting the pertinent part:

        ;; Flush the HTTP/2 connection preface (magic + initial SETTINGS) that was
        ;; written by Http2ConnectionHandler.sendPreface() during handlerAdded.
        ;; When Http2FrameCodec is added to an already-active pipeline (the normal
        ;; case for both client post-SSL-handshake and server ALPN paths),
        ;; channelActive is never replayed, so the flushPreface guard in
        ;; PrefaceDecoder.channelActive never fires. Without this explicit flush,
        ;; the preface sits in SslHandler.pendingUnencryptedWrites and under
        ;; certain allocator/timing conditions (e.g., unpooled allocator on
        ;; JDK 21), a SETTINGS ACK can be flushed before the initial SETTINGS,
        ;; causing the peer to reject the connection.
        ;; See https://github.com/netty/netty/issues/12089
        (let [ch (.channel pipeline)]
          (when (.isActive ch)
            (.flush ch)))

    I haven't yet verified this but wanted to share with you already. Does it make sense?

  15. normanmaurer commented on Mar 16, 2026

    @normanmaurer
    normanmaurer
    on Mar 16, 2026
    Member
    More actions

    @DerGuteMoritz hmm not really as the SslHandler would just put the other writes behind it.

  16. DerGuteMoritz commented on Mar 17, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Mar 17, 2026
    Author
    More actions

    @normanmaurer Right, that's what I would have thought, as well. In the meantime, the author informed me that the patch was LLM-assisted so at least the explanation in the code comment might just be hallucination. However, they also confirmed that the patch did empirically fix the issue for them when the tests were previously failing consistently with Netty 1.2 in combination with JDK 21 and the adaptive allocator. This might have just been a coincidence, though. At least I couldn't reproduce it any better so far...

  17. normanmaurer commented on Apr 14, 2026

    @normanmaurer
    normanmaurer
    on Apr 14, 2026
    Member
    More actions

    @DerGuteMoritz I wonder if this is related to #16636

  18. DerGuteMoritz commented on Apr 15, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Apr 15, 2026
    Author
    More actions

    @normanmaurer Ah very interesting, thanks for notifying me! However, IIUIC that patch pertains to the client's behavior, right? In the cases we encountered so far, it was the server which sent something other than the preface as the initial message. Somewhat stabbing in the dark: Perhaps the same change needs to be applied to Http2ConnectionHandler#bind?

  19. DerGuteMoritz commented on May 5, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on May 5, 2026
    Author
    More actions

    @normanmaurer Just saw the release notes for 4.2.13 / 4.1.133 and found that you implemented my suggestion above with #16667, right? Thanks a lot 👍 Will let you know if it happens again after updating to the new version. In the meantime, feel free to close this issue.

    Reacted by Norman Maurer
  20. DerGuteMoritz commented on Jun 5, 2026

    @DerGuteMoritz
    DerGuteMoritz
    on Jun 5, 2026
    Author
    More actions

    @normanmaurer Unfortunately, it just happened again on my PR to update to 4.1.135. Could it be a regression since 4.1.133?

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

Metadata

Metadata

Assignees

  • @normanmaurer
    normanmaurer

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    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.