I'm migrating a big project to Java 8. We had to update several big pieces of our project:
JBoss AS 7.2 -> Wildfly 10 Final
JBoss AS OSGi submodule -> JBoss OSGi 2.5.2 Final
We started experimenting after these updates but after a while realized our startup was eating tons (10Gb+) of memory and timing out at startup(10mins+). After some testing it seemed like Spring ORM was eating up resources. With it and dependant services commented away the startup was faster and ate up less memory, but was still not fast enough. I built a test project with far less bundles and tested with Spring 3 and 4 separately. Spring 3 took over 70s to start and Spring 4 took around 20 seconds to start.
We chose to upgrade:
Spring 3.2.3 -> Spring 4.2.5(bundled by Apache Servicemix)
Eclipse Gemini Blueprint 1.0.2 -> 2.0.0.RELEASE
Hibernate 4.2 -> 5.0.7
Now I have reconstructed our project with the new versions and I'm testing starting up Wildfly again. Sadly, we still have major performance issues. Startup takes minutes(with JBoss AS 7 it took between 40-60s) and still eats a lot of memory as well. After the JBoss OSGi subsystem has started up GC will clear memory without issues, but the startup will crash with out of memory error if I limit the memory to for example 4gb(with -Xmx 4000M).
I have been logging everything with DEBUG level and gone through the logs, but I can't find the root cause of the issue. When the memory limit is reached it seems to always be stuck on addExportedPaths() loop in JBoss MODULES Module.Java class. With VisualVM I can see that memory seems to fill up with Object arrays and FastCopyHashSet and Module$Visited objects. After reviewing Module.java code, the cause might be a dependency loop somewhere. Is this possible or would JBoss MODULES/JBoss OSGi detect it ? Note that the startup is slowed down while starting bundles, not when dependencies are first resolved and bundles installed. Does anyone have any other ideas on what could be causing this?
If you need more information, please ask. I can't provide complete logs or standalone.xml due to company policy, but I can provide snippets based on any information you might need.