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 — Occasional SSL BAD_DECRYPT exception after upgrading Netty from 4.1.131.Final to 4.2.10.Final · Issue #16529 · netty/netty

Occasional SSL BAD_DECRYPT exception after upgrading Netty from 4.1.131.Final to 4.2.10.Final #16529

New issue
Copy link
New issue
Copy link
Open
Open
Occasional SSL BAD_DECRYPT exception after upgrading Netty from 4.1.131.Final to 4.2.10.Final#16529
Copy link

Description

@michelezoncheddu
michelezoncheddu
opened on Mar 20, 2026
Issue body actions

Environment:

  • Netty version: 4.2.10.Final
  • Netty native: netty-tcnative-boringssl-static-2.0.75.Final
  • Arch: AArch64
  • Java version: 25
  • Server is using io_uring

Description:
Symptoms seem similar to an older issue, #15037: very occasionally wee see BAD_DECRYPT errors, and they started to appear only after the Netty upgrade.

Happy to provide more details if needed!

Full stack trace:

javax.net.ssl.SSLException: io.netty.handler.ssl.ReferenceCountedOpenSslEngine$OpenSslException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT
	at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.wrap(ReferenceCountedOpenSslEngine.java:960)
	at java.base/javax.net.ssl.SSLEngine.wrap(SSLEngine.java:558)
	at io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:1160)
	at io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:890)
	at io.netty.handler.ssl.SslHandler.wrapAndFlush(SslHandler.java:842)
	at io.netty.handler.ssl.SslHandler.flush(SslHandler.java:823)
	at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:760)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.flush(Http2ConnectionHandler.java:195)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.channelReadComplete(Http2ConnectionHandler.java:559)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelReadComplete(AbstractChannelHandlerContext.java:387)
	at io.netty.handler.ssl.SslHandler.channelReadComplete0(SslHandler.java:1463)
	at io.netty.handler.ssl.SslHandler.channelReadComplete(SslHandler.java:1452)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelReadComplete(AbstractChannelHandlerContext.java:387)
	at io.netty.handler.timeout.IdleStateHandler.channelReadComplete(IdleStateHandler.java:297)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelReadComplete(AbstractChannelHandlerContext.java:385)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelReadComplete(DefaultChannelPipeline.java:1434)
	at io.netty.channel.DefaultChannelPipeline.fireChannelReadComplete(DefaultChannelPipeline.java:932)
	at io.netty.channel.uring.AbstractIoUringStreamChannel$IoUringStreamUnsafe.scheduleNextRead(AbstractIoUringStreamChannel.java:539)
	at io.netty.channel.uring.AbstractIoUringStreamChannel$IoUringStreamUnsafe.readComplete0(AbstractIoUringStreamChannel.java:522)
	at io.netty.channel.uring.AbstractIoUringChannel$AbstractUringUnsafe.readComplete(AbstractIoUringChannel.java:754)
	at io.netty.channel.uring.AbstractIoUringChannel$AbstractUringUnsafe.handle(AbstractIoUringChannel.java:461)
	at io.netty.channel.uring.IoUringIoHandler$DefaultIoUringIoRegistration.handle(IoUringIoHandler.java:598)
	at io.netty.channel.uring.IoUringIoHandler.handle(IoUringIoHandler.java:288)
	at io.netty.channel.uring.IoUringIoHandler$$Lambda/0x000003e002d47000.handle(Unknown Source)
	at io.netty.channel.uring.CompletionQueue.process(CompletionQueue.java:149)
	at io.netty.channel.uring.IoUringIoHandler.processCompletionsAndHandleOverflow(IoUringIoHandler.java:197)
	at io.netty.channel.uring.IoUringIoHandler.run(IoUringIoHandler.java:186)
	at io.netty.channel.SingleThreadIoEventLoop.runIo(SingleThreadIoEventLoop.java:225)
	at io.netty.channel.SingleThreadIoEventLoop.run(SingleThreadIoEventLoop.java:196)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1195)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.runWith(Thread.java:1487)
	at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: io.netty.handler.ssl.ReferenceCountedOpenSslEngine$OpenSslException: error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT
	at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.newSSLExceptionForError(ReferenceCountedOpenSslEngine.java:1414)
	at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.needWrapAgain(ReferenceCountedOpenSslEngine.java:1399)
	at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.sslReadErrorResult(ReferenceCountedOpenSslEngine.java:1430)
	at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1361)
	at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1461)
	at io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1504)
	at io.netty.handler.ssl.SslHandler$SslEngineType$1.unwrap(SslHandler.java:219)
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1502)
	at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1406)
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1446)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:545)
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:484)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:288)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1429)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)
	at io.netty.channel.uring.AbstractIoUringStreamChannel$IoUringStreamUnsafe.readComplete0(AbstractIoUringStreamChannel.java:520)
	... 15 common frames omitted

Activity

  1. normanmaurer commented on Mar 20, 2026

    @normanmaurer
    normanmaurer
    on Mar 20, 2026
    Member
    More actions

    @michelezoncheddu do both netty versions use the same netty-tcnative versions ?

  2. michelezoncheddu commented on Mar 20, 2026

    @michelezoncheddu
    michelezoncheddu
    on Mar 20, 2026
    Author
    More actions

    @michelezoncheddu do both netty versions use the same netty-tcnative versions ?

    Yes, we're mirroring the ones in netty's pom file

  3. normanmaurer commented on Mar 20, 2026

    @normanmaurer
    normanmaurer
    on Mar 20, 2026
    Member
    More actions

    @michelezoncheddu hmm I also see io_uring which does not exists in 4.1 (only the incubator version which is very different). Can you reproduce it when you run epoll or nio on both ?

  4. michelezoncheddu commented on Mar 20, 2026

    @michelezoncheddu
    michelezoncheddu
    on Mar 20, 2026
    Author
    More actions

    @michelezoncheddu hmm I also see io_uring which does not exists in 4.1 (only the incubator version which is very different). Can you reproduce it when you run epoll or nio on both ?

    Good point, we switched to io_uring with the upgrade; we'll try again with epoll (that we used before) and let you know. Thanks a lot for now!

    Reacted by Norman Maurer
  5. michelezoncheddu commented on Mar 23, 2026

    @michelezoncheddu
    michelezoncheddu
    on Mar 23, 2026
    Author
    More actions

    So, switching to epoll didn't solve the issue, and also the frequency of errors didn't change.

    And maybe this is worth a separate issue but I'll mention it here as it might help in the investigation:
    Since we upgraded to Netty 4.2.10.Final we also have another exception, which is even less frequent: it seems that sometimes we're not receiving the last HTTP/2 frame, with the error io.netty.handler.codec.http2.Http2Exception$StreamException: Received amount of data 5297282 does not match content-length header 5313666, and the difference between the two sizes is 16384, exactly HTTP/2's MAX_FRAME_SIZE.

    To give an idea of the frequency, our servers are receiving a few millions of HTTP requests per second, and the SSLException occurs 5-10 times per day, while the StreamException 0-1 times per day.

    This is the full stack trace:

    io.netty.handler.codec.http2.Http2Exception$StreamException: Received amount of data 5297282 does not match content-length header 5313666
    	at io.netty.handler.codec.http2.Http2Exception.streamError(Http2Exception.java:142)
    	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$ContentLength.increaseReceivedBytes(DefaultHttp2ConnectionDecoder.java:829)
    	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.verifyContentLength(DefaultHttp2ConnectionDecoder.java:238)
    	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.access$300(DefaultHttp2ConnectionDecoder.java:53)
    	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onDataRead(DefaultHttp2ConnectionDecoder.java:311)
    	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readDataFrame(DefaultHttp2FrameReader.java:408)
    	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:244)
    	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:164)
    	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:186)
    	at io.netty.handler.codec.http2.DecoratingHttp2ConnectionDecoder.decodeFrame(DecoratingHttp2ConnectionDecoder.java:61)
    	at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:400)
    	at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:460)
    	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:545)
    	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:484)
    	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1535)
    	at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1406)
    	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1446)
    	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:545)
    	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:484)
    	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:288)
    	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
    	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1429)
    	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)
    	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:804)
    	at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.handle(AbstractEpollChannel.java:482)
    	at io.netty.channel.epoll.EpollIoHandler$DefaultEpollIoRegistration.handle(EpollIoHandler.java:317)
    	at io.netty.channel.epoll.EpollIoHandler.processReady(EpollIoHandler.java:515)
    	at io.netty.channel.epoll.EpollIoHandler.run(EpollIoHandler.java:460)
    	at io.netty.channel.SingleThreadIoEventLoop.runIo(SingleThreadIoEventLoop.java:225)
    	at io.netty.channel.SingleThreadIoEventLoop.run(SingleThreadIoEventLoop.java:196)
    	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1195)
    	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    	at java.base/java.lang.Thread.runWith(Thread.java:1487)
    	at java.base/java.lang.Thread.run(Thread.java:1474)
  6. michelezoncheddu commented on Mar 26, 2026

    @michelezoncheddu
    michelezoncheddu
    on Mar 26, 2026
    Author
    More actions

    By the end of the week I'll launch a test on a deterministic simulation testing environment to hopefully reproduce it and debug it more easily.

    Do you have any idea/guess on what might have been happening?

    Reacted by Marcus Hodgson
  7. normanmaurer commented on Mar 26, 2026

    @normanmaurer
    normanmaurer
    on Mar 26, 2026
    Member
    More actions

    By the end of the week I'll launch a test on a deterministic simulation testing environment to hopefully reproduce it and debug it more easily.

    Do you have any idea/guess on what might have been happening?

    Unfortunately no idea yet...

  8. michelezoncheddu commented on Jun 24, 2026

    @michelezoncheddu
    michelezoncheddu
    on Jun 24, 2026
    Author
    More actions

    Hi @normanmaurer! We haven't managed to reproduce the exact exceptions, but with the upgrade from 4.2.13.Final to 4.2.14.Final both errors are gone. Maybe this can help to narrow the source of errors to be sure it's not reintroduced later on.

  9. michelezoncheddu commented on Jul 6, 2026

    @michelezoncheddu
    michelezoncheddu
    on Jul 6, 2026
    Author
    More actions

    I have a suspect: Netty's SslHandler is using ByteToMessageDecoder's COMPOSITE_CUMULATOR (which is backed by a CompositeByteBuffer), and in the changelog we see that the PR Revert CompositeByteBuf component search fast path was merged. Since then, the bugs are gone. Could this explain the two exceptions? They both have the SslHandler in the stack trace

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

      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.