[ 
https://issues.apache.org/jira/browse/NIFI-15388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18050696#comment-18050696
 ] 

ASF subversion and git services commented on NIFI-15388:
--------------------------------------------------------

Commit f90656f9809cb0dbfe323aa5cab7369933931765 in nifi's branch 
refs/heads/main from Bob Paulin
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=f90656f980 ]

NIFI-15388 Fixed Reference Leak in ReflectionUtils annotation cache (#10691)

- WeakHashMap does not work properly to remove keys and values due to strong 
reference to the Key found in the Cache Value
- Keys should be programatically invalidated when the ClassLoader is closed to 
allow classes to be Garbage Collected
- Moved ReflectionUtils to nifi-nar-utils so it can be shared by 
nifi-framework-nar-utils and nifi-framework-components

Signed-off-by: David Handermann <[email protected]>

> Leak in ReflectionUtils annotation cache. 
> ------------------------------------------
>
>                 Key: NIFI-15388
>                 URL: https://issues.apache.org/jira/browse/NIFI-15388
>             Project: Apache NiFi
>          Issue Type: Bug
>            Reporter: Bob Paulin
>            Assignee: Bob Paulin
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> When org.apache.nifi.util.ReflectionUtils invoke methods are called 
> annotations are cached in a WeakHashMap.  While keys (Class) in the 
> WeakHashMap are weak references the values (Methods) are strong references.  
> The classes can not then be garbaged collected because the Methods have a 
> reference to there class.  
>  
> -So the values that are added to the cache should also be wrapped in a 
> WeakReference.  Then the classes can be garbage collected.-
>  
> Keys should be removed from the cache when the ClassLoader is removed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to