You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/05/18 14:36:01 UTC
[jira] [Commented] (DELTASPIKE-519) ClassLoader leak in
ClassDeactivationUtils
[ https://issues.apache.org/jira/browse/DELTASPIKE-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17110347#comment-17110347 ]
ASF subversion and git services commented on DELTASPIKE-519:
------------------------------------------------------------
Commit d826c9686ca85a79b4e8f52beda4ab78b38bb680 in deltaspike's branch refs/heads/master from Mark Struberg
[ https://gitbox.apache.org/repos/asf?p=deltaspike.git;h=d826c96 ]
DELTASPIKE-519 fix potential ClassLoader leak
> ClassLoader leak in ClassDeactivationUtils
> ------------------------------------------
>
> Key: DELTASPIKE-519
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-519
> Project: DeltaSpike
> Issue Type: Bug
> Components: Core
> Affects Versions: 0.5
> Reporter: Moritz Bechler
> Assignee: Mark Struberg
> Priority: Critical
>
> ClassDeactivationUtils statically holds two maps (classDeactivatorMap, activationStatusCache) one having a classloader as key and the other a class. These entries are never removed resulting in leaks of the TCCL or the classloaders of Deactivatable classes if they do not equal the classloader loading deltaspike.
> Suggested fix:
> {code}
> /**
> * This Map holds the ClassLoader as first level to make it possible to have different configurations per
> * WebApplication in an EAR or other Multi-ClassLoader scenario.
> *
> * The Map then contains a List of {@link ClassDeactivator}s in order of their configured ordinal.
> */
> private static Map<ClassLoader, List<ClassDeactivator>> classDeactivatorMap
> = Collections.synchronizedMap(new WeakHashMap<ClassLoader, List<ClassDeactivator>>());
> /**
> * Cache for the result. It won't contain many classes but it might be accessed frequently.
> * Valid entries are only true or false. If an entry isn't available or null, it gets calculated.
> */
> private static Map<Class<? extends Deactivatable>, Boolean> activationStatusCache
> = Collections.synchronizedMap(new WeakHashMap<Class<? extends Deactivatable>, Boolean>());
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)