You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The class javax.swing.ImageIcon causes a classloader leak which is not covered yet by default (as of classloader-leak-prevention 2.7.0).
Steps to reproduce:
Build the attached example project imageicon-leak.zip (mvn clean install)
Deploy the .war file into a Tomcat 8.5.65
Undeploy it again
Then the classloader is not garbage collected due to the following Path2GC:
Obviously the instance of the anonymous class javax.swing.ImageIcon$3 has a reference to an AccessControlContext retaining the ParallelWebappClassLoader. It is created at ImageIcon.java line 347 (from AdoptOpenJDK jdk8u272-b10):
privateMediaTrackergetTracker() {
ObjecttrackerObj;
AppContextac = AppContext.getAppContext();
// Opt: Only synchronize if trackerObj comes back null?// If null, synchronize, re-check for null, and put new trackersynchronized(ac) {
trackerObj = ac.get(TRACKER_KEY);
if (trackerObj == null) {
Componentcomp = newComponent() {}; // <--- javax.swing.ImageIcon$3trackerObj = newMediaTracker(comp);
ac.put(TRACKER_KEY, trackerObj);
}
}
return (MediaTracker) trackerObj;
}
Adding the following clean-up step solves this issue:
The class
javax.swing.ImageIcon
causes a classloader leak which is not covered yet by default (as of classloader-leak-prevention 2.7.0).Steps to reproduce:
Then the classloader is not garbage collected due to the following Path2GC:
Obviously the instance of the anonymous class
javax.swing.ImageIcon$3
has a reference to anAccessControlContext
retaining theParallelWebappClassLoader
. It is created at ImageIcon.java line 347 (from AdoptOpenJDK jdk8u272-b10):Adding the following clean-up step solves this issue:
The text was updated successfully, but these errors were encountered: