Conversation
The new netty LeakPresenceDetector allows for leak detection that is more lightweight, faster, and more reliable. Add a micronaut-test module that enables leak detection through a jupiter and a spock extension.
yawkat
added a commit
to micronaut-projects/micronaut-core
that referenced
this pull request
Oct 17, 2025
Netty 4.2.7 introduced a new leak detection mechanism for tests that is more reliable and has lower overhead. micronaut-projects/micronaut-test#1291 introduces a micronaut-test module that uses this new mechanism. However, the new detector is more strict about resource lifetimes, so tests need various small adjustments: - Contexts must be closed at the end of the test - Event loops must be shut down - Tests must use only threads created in those tests (no Finalizers, no reactive boundedElastic) - SSL contexts must be released immediately There is also one minor leak fix in this PR, related to h2c support, in Http2ServerHandler. Draft because this requires the new micronaut-test module.
graemerocher
approved these changes
Oct 17, 2025
sdelamo
requested changes
Oct 17, 2025
melix
requested changes
Oct 17, 2025
melix
approved these changes
Oct 17, 2025
sdelamo
approved these changes
Oct 17, 2025
|
Member
Author
|
The remaining CI failures look unrelated, I think this can be safely merged @sdelamo |
Btw, I am seeing this error all over when test-resources are used in 4.x branches. Seem to work fine in branches for Micronaut 5.x |
yawkat
added a commit
to micronaut-projects/micronaut-core
that referenced
this pull request
Dec 15, 2025
* New leak detection for tests Netty 4.2.7 introduced a new leak detection mechanism for tests that is more reliable and has lower overhead. micronaut-projects/micronaut-test#1291 introduces a micronaut-test module that uses this new mechanism. However, the new detector is more strict about resource lifetimes, so tests need various small adjustments: - Contexts must be closed at the end of the test - Event loops must be shut down - Tests must use only threads created in those tests (no Finalizers, no reactive boundedElastic) - SSL contexts must be released immediately There is also one minor leak fix in this PR, related to h2c support, in Http2ServerHandler. Draft because this requires the new micronaut-test module. * move to micronaut-test module * fix test * Update gradle/libs.versions.toml Co-authored-by: Sergio del Amo <sergio.delamo@softamo.com> * enable trackCreationStack * disable trackCreationStack --------- Co-authored-by: Sergio del Amo <sergio.delamo@softamo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The new netty LeakPresenceDetector allows for leak detection that is more lightweight, faster, and more reliable. Add a micronaut-test module that enables leak detection through a jupiter and a spock extension.