-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Description
Hi
I think there's some problem with class unloading when deploying a spring boot application as war on a web server such as wildfly.
I had this issue where after some deployments I got OOM Metaspace error. In order to discard some bug in my code causing this problem I created a new spring boot project with https://start.spring.io/ and deployed it a few times getting an OOM Metaspace error again. So my guess is that there's something in springboot itself causing the problem.
Steps to reproduce:
- Go to https://start.spring.io/
- Change packaging from jar to war
- Add spring web dependency (not sure if it's a necessary step)
- Download wildfly
- Open the project and build the war file
- Deploy it to wildfly
- Redeploying the project will increase the amount of classes loaded, and the metaspace used until there's no free space left getting the OOM Metaspace error
Tip: If you run wildfly with -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m you'll reach OOM Metaspace error with about 10 redeployments. If you are wondering where did I get these numbers, I think this is the default configuration of https://hub.docker.com/r/jboss/wildfly/
I attached a screenshot of visualVM monitoring the redeployments where you can clearly see how metaspace increases after each redeploy
FYI: I don't know much about class loading/unloading, metaspace issues, etc. but this is the conclusion I reached after some research. If this is not the right place to report this issue feel free to close it. Anyway any help or orientation will be much appreciated
Thanks
