You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a Micronaut test is annotated like @MicronautTest(rebuildContext = true), I'd expect everything to be cleaned up including the registered metrics objects (when using Micronaut Micrometer integration).
Actual Behaviour
It seems like metrics objects are not cleaned up, while new ones are created for each test every time the context is rebuilt, eventually resulting in java.lang.OutOfMemoryError.
Existing workaround is to disable metrics if they are not needed by the tests, via micronaut.metrics.binders.kafka.enabled or micronaut.metrics.binders.kafka.streams.enabled.
Steps To Reproduce
We have a Kafka Streams project with 70+ tests that require rebuildContext = true due to the use of @Requires and @Property (as documented here). For each test, different Kafka streams are created.
Eventually, it hangs and results in OutOfMemoryError in some application thread (unrelated to Kafka streams). We took a heap dump on out of memory error and analyzed it with VisualVM. We can observe the number of KafkaMetricMeterType object is quite high, which suggests that they are not cleaned up every time context is rebuilt.
Please, see screenshot below.
Environment Information
JDK 21
Example Application
No response
Version
4.3.3
The text was updated successfully, but these errors were encountered:
Expected Behavior
If a Micronaut test is annotated like
@MicronautTest(rebuildContext = true)
, I'd expect everything to be cleaned up including the registered metrics objects (when using Micronaut Micrometer integration).Actual Behaviour
It seems like metrics objects are not cleaned up, while new ones are created for each test every time the context is rebuilt, eventually resulting in
java.lang.OutOfMemoryError
.Existing workaround is to disable metrics if they are not needed by the tests, via
micronaut.metrics.binders.kafka.enabled
ormicronaut.metrics.binders.kafka.streams.enabled
.Steps To Reproduce
We have a Kafka Streams project with 70+ tests that require
rebuildContext = true
due to the use of@Requires
and@Property
(as documented here). For each test, different Kafka streams are created.Eventually, it hangs and results in
OutOfMemoryError
in some application thread (unrelated to Kafka streams). We took a heap dump on out of memory error and analyzed it with VisualVM. We can observe the number ofKafkaMetricMeterType
object is quite high, which suggests that they are not cleaned up every time context is rebuilt.Please, see screenshot below.
Environment Information
JDK 21
Example Application
No response
Version
4.3.3
The text was updated successfully, but these errors were encountered: