Version - Tomcat 8.5.38 OS - Centos 7.6 JVM - openjdk 1.8, 4 CPU We recently upgraded an existing server running a Spring 3.0 web app from Tomcat 8.5.35 to 8.5.38.
After the upgrade, I noticed OutOfMemory exceptions several times. Increasing the heap size (-Xmx) several times upto nearly twice (from 6 GB to 10 GB) helped bring the problem under control. I was worried about a memory leak and so took a heap dump. Upon inspection I noticed that there were 2 copies of 2 large HashMap objects that we use as a cache for fast lookup. I noticed that this was because there were 2 instances of org.apache.catalina.loader.ParallelWebappClassLoader. Downgrading to 5.3.35, reduced the heap size to half and the problem was gone. In the new heap dump, there was only one instance of ParallelWebappClassLoader. My question is - why does Tomcat 5.3.38 create 2 instances of ParallelWebappClassLoader, while 5.3.35 creates only one?Is there a way to conigure the number of instances of ParallelWebappClassLoaderwhen upgrading to 8.5.38? Thanks for reading. I have also posted the same problem in Stackoverflow - https://stackoverflow.com/questions/55154963/behavior-of-multiple-instance-of-parallelwebappclassloaders-in-tomcat-jvm-retain