Skip to content

Fix SelfSignCertificate initialization in tests - #17024

Merged
normanmaurer merged 2 commits into
netty:5.0from
chrisvest:5.0-selfsigncert
Jul 1, 2026
Merged

normanmaurer merged 2 commits into
netty:5.0from
chrisvest:5.0-selfsigncert

Conversation

@chrisvest

Copy link
Copy Markdown
Member

Motivation:
The SelfSignedCertificate may allocate ByteBuf instances, which have leak detection. The CachedSelfSignedCertificate then stores the SelfSignedCertificate in a static field. The LeakPresenceDetector sees this as an allocation outside of a test scope.

Modification:
Tell the LeakPresenceDetector that we're allocating for a static field.

Result:
No more errors from the LeakPresenceDetector about self signed certificates.

Motivation:
The SelfSignedCertificate may allocate ByteBuf instances, which have leak detection.
The CachedSelfSignedCertificate then stores the SelfSignedCertificate in a static field.
The LeakPresenceDetector sees this as an allocation outside of a test scope.

Modification:
Tell the LeakPresenceDetector that we're allocating for a static field.

Result:
No more errors from the LeakPresenceDetector about self signed certificates.
@chrisvest chrisvest added this to the 5.0.0.Final milestone Jun 30, 2026
@chrisvest chrisvest added the needs-cherry-pick-4.2 This PR should be cherry-picked to 4.2 once merged. label Jun 30, 2026
@chrisvest
chrisvest requested a review from yawkat June 30, 2026 21:42
@normanmaurer
normanmaurer merged commit 05335ba into netty:5.0 Jul 1, 2026
11 of 13 checks passed
@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.2: #17029

@github-actions github-actions Bot removed the needs-cherry-pick-4.2 This PR should be cherry-picked to 4.2 once merged. label Jul 1, 2026
normanmaurer pushed a commit that referenced this pull request Jul 1, 2026
Auto-port of #17024 to 4.2
Cherry-picked commit: 05335ba

---
Motivation:
The SelfSignedCertificate may allocate ByteBuf instances, which have
leak detection. The CachedSelfSignedCertificate then stores the
SelfSignedCertificate in a static field. The LeakPresenceDetector sees
this as an allocation outside of a test scope.

Modification:
Tell the LeakPresenceDetector that we're allocating for a static field.

Result:
No more errors from the LeakPresenceDetector about self signed
certificates.

Co-authored-by: Chris Vest <[email protected]>
Co-authored-by: Jonas Konrad <[email protected]>
@chrisvest
chrisvest deleted the 5.0-selfsigncert branch July 1, 2026 15:17
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.

4 participants