Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Jersey » WebappClassLoader Leak(Tomcat 7, Jersey 2.33, objects retained in memory)
WebappClassLoader Leak [message #1837472] Sun, 31 January 2021 02:01 Go to next message
Mark Eggers is currently offline Mark EggersFriend
Messages: 2
Registered: January 2021
Junior Member
I'm working with a very simple Jersey REST application to access a MySQL database. My environment:

Windows 10 Professional (64 bit, latest updates)
OpenJDK 11.0.10
Apache Tomcat 7.0.107
Jersey Rest 2.33

I've included the application configuration file and a sample resource file.

The InstituteInfo class is a DAO that returns a JavaBean container with the results to be serialized to JSON.

This all works well, and various web applications can consume the information.

Unfortunately when I undeploy the web application, Tomcat reports a leak. This is confirmed by Eclipse MAT, analyzing the heap dump with the following OQL:

SELECT wcl.contextName.toString() AS contextName,
   wcl.started AS started,
   wcl.@retainedHeapSize AS retainedSize
FROM org.apache.catalina.loader.WebappClassLoader wcl

The result is:

contextName started retainedSize
/cplanapi false 586,720

The GC root is:

class com.sun.naming.internal.ResourceManager
'- propertiesCache java.util.WeakHashMap
'- table java.util.WeakHashMap$Entry[16]
'- [13] java.util.WeakHashMap$Entry
'- referent org.apache.catalina.loader.WebappClassLoader

This also occurs on Linux, and with JRE 8 instead of 11.

Any solutions would be much appreciated.
Re: WebappClassLoader Leak [message #1837496 is a reply to message #1837472] Mon, 01 February 2021 06:46 Go to previous message
Mark Eggers is currently offline Mark EggersFriend
Messages: 2
Registered: January 2021
Junior Member
It turns out that this is a false flag. Doing a complete GC on the Tomcat instance removed this from the heap.

Unfortunately, hot redeploys without a GC have the potential to create an OOM MetaSpace issue before a GC is triggered. This means that I probably need to look at my MetaSpace and GC configurations.

Sorry for the noise.
Previous Topic:ResourceFilter and ResourceFilterFactory Interfaces were Removed
Next Topic:Object instantiation problem
Goto Forum:

Current Time: Mon Jul 04 05:26:32 GMT 2022

Powered by FUDForum. Page generated in 0.02007 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top