Skip to content

Port: Http2MultiplexTransportTest: Fix possible SslContext leak in tests (#17597) - #17599

Merged
normanmaurer merged 1 commit into
4.1from
m41
Sep 23, 2026
Merged

normanmaurer merged 1 commit into
4.1from
m41

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

Motivation:

testSslException and testFireChannelReadAfterHandshakeSuccess only
released the server/client SslContext on the happy path, after
latch.await() returned successfully. If an exception was thrown
earlier (for example while binding or connecting), the SslContext and
the native OpenSSL key material it holds were never released
explicitly, and cleanup would only happen once the JVM finalizer ran.
This races with the leak presence detector's afterAll check and can
be reported as a flaky memory leak in this test class.

Modifications:

  • Release the SslContext instances in a finally block so they are
    always released, even if an exception is thrown.

Result:

Fix possible SslContext leak in unit tests.

…sts (#17597)

Motivation:

testSslException and testFireChannelReadAfterHandshakeSuccess only
released the server/client SslContext on the happy path, after
latch.await() returned successfully. If an exception was thrown
earlier (for example while binding or connecting), the SslContext and
the native OpenSSL key material it holds were never released
explicitly, and cleanup would only happen once the JVM finalizer ran.
This races with the leak presence detector's afterAll check and can
be reported as a flaky memory leak in this test class.

Modifications:

- Release the SslContext instances in a finally block so they are
  always released, even if an exception is thrown.

Result:

Fix possible SslContext leak in unit tests.
@testlens-app

testlens-app Bot commented Sep 23, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 5eec24f
▶️ Tests: 398689 executed
⚪️ Checks: 17/17 completed


Learn more about TestLens at testlens.app/docs.

@normanmaurer
normanmaurer merged commit 6f06ba5 into 4.1 Sep 23, 2026
18 checks passed
@normanmaurer
normanmaurer deleted the m41 branch September 23, 2026 00:58
@normanmaurer normanmaurer added this to the 4.1.139.Final milestone Sep 23, 2026
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
…sts (netty#17597) (netty#17599)

Motivation:

testSslException and testFireChannelReadAfterHandshakeSuccess only
released the server/client SslContext on the happy path, after
latch.await() returned successfully. If an exception was thrown
earlier (for example while binding or connecting), the SslContext and
the native OpenSSL key material it holds were never released
explicitly, and cleanup would only happen once the JVM finalizer ran.
This races with the leak presence detector's afterAll check and can
be reported as a flaky memory leak in this test class.

Modifications:

- Release the SslContext instances in a finally block so they are
  always released, even if an exception is thrown.

Result:

Fix possible SslContext leak in unit tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant