You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Vadim Pakhnushev (Jira)" <ji...@apache.org> on 2023/02/20 11:48:00 UTC
[jira] [Commented] (IGNITE-18604) Memory Leak in Micronaut
[ https://issues.apache.org/jira/browse/IGNITE-18604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17691147#comment-17691147 ]
Vadim Pakhnushev commented on IGNITE-18604:
-------------------------------------------
Classes annotated with {{@Controller}} are leaking from the {{io.micronaut.web.router.AnnotatedMethodRouteBuilder}} which are held by the singleton {{io.micronaut.web.router.DefaultRouter}} which in the end is held by the {{io.micronaut.http.server.netty.NettyHttpServer}}. I couldn't find a way to reliably clean all of these references.
> Memory Leak in Micronaut
> ------------------------
>
> Key: IGNITE-18604
> URL: https://issues.apache.org/jira/browse/IGNITE-18604
> Project: Ignite
> Issue Type: Improvement
> Reporter: Ivan Bessonov
> Priority: Major
> Labels: ignite-3
>
> Micronaut class code contains the following code:
> {code:java}
> Runtime.getRuntime().addShutdownHook(new Thread(() -> {
> if (LOG.isInfoEnabled()) {
> LOG.info("Embedded Application shutting down");
> }
> if (embeddedApplication.isRunning()) {
> embeddedApplication.stop();
> countDownLatch.countDown();
> if (finalKeepAlive) {
> mainThread.interrupt();
> }
> }
> })); {code}
> This hook is never removed, thus there's a GC root for the "embeddedApplication" instance. It leaks beans and other stuff, for example:
> * io.micronaut.runtime.Micronaut#exitHandlers
> * io.micronaut.context.DefaultApplicationContextBuilder#singletons
> * ...
> This is bad, because inside of all of this we have classes like ClusterManagementRestFactory and
> ClusterManagementController that refer to Ignite components and have particularly big footprints.
>
> As a result, if you run org.apache.ignite.internal.rest.ItGeneratedRestClientTest in a loop, it eats all the memory.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)