You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Ivan Bessonov (Jira)" <ji...@apache.org> on 2023/01/23 11:30:00 UTC

[jira] [Created] (IGNITE-18604) Memory Leak in Micronaut

Ivan Bessonov created IGNITE-18604:
--------------------------------------

             Summary: Memory Leak in Micronaut
                 Key: IGNITE-18604
                 URL: https://issues.apache.org/jira/browse/IGNITE-18604
             Project: Ignite
          Issue Type: Improvement
            Reporter: Ivan Bessonov


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)