0

I am working on identifying repeated OutOfMemory issues in a Tomcat 8.5.38 server (Centos 7.6, openjdk 1.8, 4 CPU) running a Spring MVC application.

This issue is new for this app. (Edit: The issue started after Tomcat was upgraded from 8.5.35 to 8.5.38). I saved a memory heap dump by adding the “-XX:+HeapDumpOnOutOfMemoryError” JVM setting. In the heap dump I see that there are 2 instances of ParallelWebAppClassLoader. This app uses a large HashMap (about 200 Mb) of lookup values as a cache. Each class loader has a separate reference to this HashMap. I am trying to find why there are 2 ParallelWebAppClassLoader instances in this JVM? The server.xml does not specify the use of ParallelWebAppClassLoader.

Also is it correct to expect the ParallelWebAppClassLoader to maintain a copy of the HashMap?

If it is 2 copies of the same object, how can this duplicate space be optimized, if ParallelWebAppClassLoader is used?

Shankar
  • 2,625
  • 3
  • 25
  • 49

1 Answers1

0

The issue was because of the upgrade of Tomcat from 8.5.35 to 8.5.35. After this upgrade the JVM has two class loaders, and thus occupies twice the memory. A quick fix can be by increasing the RAM or rolling back the Tomcat version to 8.5.35.

If there is a setting to control the number of class loaders, please post an answer. I will upvote that.

Shankar
  • 2,625
  • 3
  • 25
  • 49
  • For more details, please refer http://mail-archives.apache.org/mod_mbox/tomcat-users/201903.mbox/%3Ce4da8d9b-e6bb-f120-4877-7b61e1caca23@christopherschultz.net%3E – Shankar Jun 17 '19 at 18:12