You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Mikhail Pochatkin (Jira)" <ji...@apache.org> on 2023/03/03 12:25: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=17696136#comment-17696136 ] 

Mikhail Pochatkin commented on IGNITE-18604:
--------------------------------------------

Before  
!screenshot-1.png! 

After
 !screenshot-2.png! 

> Memory Leak in Micronaut
> ------------------------
>
>                 Key: IGNITE-18604
>                 URL: https://issues.apache.org/jira/browse/IGNITE-18604
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Ivan Bessonov
>            Assignee: Mikhail Pochatkin
>            Priority: Major
>              Labels: ignite-3
>         Attachments: screenshot-1.png, screenshot-2.png
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)