[ 
https://issues.apache.org/jira/browse/HDDS-16553?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ivan Andika updated HDDS-16553:
-------------------------------
    Description: 
A possible leak, note this is just from looking at the XceiverClientSpi and 
XceiverClientManager implementations.

XceiverClientManager holds a cache for XceiverClientSpi, but it can evict any 
XceiverClientSpi even when the referenceCount is not zero. Even when the cache 
eviction triggers XceverClientSpi#setEvicted and cleanup, the cleanup is only 
carried out when the referenceCount is 0, which does not seem to guaranteed to 
happen.

This means that there is chance (not sure how big) that XceiverClientSpi#close 
is never called and this can leak things like gRPC ManagedChannel 
(XceiverClientGrpc) and Ratis Client (XCeiverClientRatis).

A possible implementation is to pin the cache entry (i.e. the cache can only be 
evicted if the referenceCount is 0). See 
[https://github.com/ben-manes/caffeine/wiki/Faq#pinning-entries]

 

  was:
A possible leak, note this is just from looking at the XceiverClientSpi and 
XceiverClientManager.

XceiverClientManager holds a cache for XceiverClientSpi, but it can evict any 
XceiverClientSpi even when the referenceCount is not zero. Even when the cache 
eviction triggers XceverClientSpi#setEvicted and cleanup, the cleanup is only 
carried out when the referenceCount is 0, which does not seem to guaranteed to 
happen.

This means that there is chance (not sure how big) that XceiverClientSpi#close 
is never called and this can leak things like gRPC ManagedChannel 
(XceiverClientGrpc) and Ratis Client (XCeiverClientRatis).

A possible implementation is to pin the cache entry (i.e. the cache can only be 
evicted if the referenceCount is 0). See 
https://github.com/ben-manes/caffeine/wiki/Faq#pinning-entries

 


> Possible leak in XceiverClientSpi
> ---------------------------------
>
>                 Key: HDDS-16553
>                 URL: https://issues.apache.org/jira/browse/HDDS-16553
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Ivan Andika
>            Assignee: Ivan Andika
>            Priority: Major
>
> A possible leak, note this is just from looking at the XceiverClientSpi and 
> XceiverClientManager implementations.
> XceiverClientManager holds a cache for XceiverClientSpi, but it can evict any 
> XceiverClientSpi even when the referenceCount is not zero. Even when the 
> cache eviction triggers XceverClientSpi#setEvicted and cleanup, the cleanup 
> is only carried out when the referenceCount is 0, which does not seem to 
> guaranteed to happen.
> This means that there is chance (not sure how big) that 
> XceiverClientSpi#close is never called and this can leak things like gRPC 
> ManagedChannel (XceiverClientGrpc) and Ratis Client (XCeiverClientRatis).
> A possible implementation is to pin the cache entry (i.e. the cache can only 
> be evicted if the referenceCount is 0). See 
> [https://github.com/ben-manes/caffeine/wiki/Faq#pinning-entries]
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to