Java – redeployment on wildfly results in OUTOFMEMORY: Metaspace
I am currently investigating our recent meta - space problems One of the main reasons seems to be that duplicate classes are loaded when redeploying war Try to use one of our wars locally. By completely canceling the heap dump after deployment, I can see that most instances created by the application still exist (even after garbage collection)
From the heap dump, I can see that it seems to be the managedthreadfactoryimpl that holds the reference
What can I do / add to the application shutdown process so that it cleans itself?
All our wars are spring applications, most of which use scheduling / asynchronous elements
We used jdk8 in wildfly 8.2
Solution
It seems that the class loader has not been unloaded Try Java mission control (JMC) and record the use case This allows you to go to a specific point in time during recording and debug the problem It gives a snapshot of classes loaded at a specific time, including stacktrace, threaddumps and many important things
JMC is included in JDK You can find more information here: https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr002.html#BABIBBDE
You don't have to go through the pain of taking a heap dump and waiting for the tool to analyze it