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

Adrien Grand commented on LUCENE-7652:
--------------------------------------

Can you also read what the value of {{LRUQueryCache.ramBytesUsed}} is?

LRUQueryCache has references to current open {{IndexReader}}s due to close 
listeners. I believe you are analysing a heap dump and recursively adding 
everything that is referenced by your {{LRUQueryCache}} while it does not make 
sense ot take open {{IndexReader}}s into account.

bq. The keys of LRUQueryCache.cache are instances of SegmentCoreReaders, and 
I've checked many of the keys, the only reference to them is 
LRUQueryCache.cache, given LRUQueryCache.cache is an IdentityHashMap, that 
means you can't even get to them outside of the cache because you can't get a 
key that's equivalent to one of these in the cache.

This indicates that you are leaking index readers. When there are no readers 
that reference a segment anymore, that segment is closed, which triggers the 
eviction of all associated entries in the query cache. You should review your 
usage of Lucene to make sure that there is a call to close() for every index 
reader that you acquire.

> LRUQueryCache / IndexSearcher.DEFAULT_QUERY_CACHE memory leak
> -------------------------------------------------------------
>
>                 Key: LUCENE-7652
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7652
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/search
>    Affects Versions: 5.4, 5.5
>            Reporter: Lae
>            Priority: Critical
>
> Our {{IndexSearcher.DEFAULT_QUERY_CACHE}} is set to use 32MB of heap (the 
> default), however upon inspection of our application's heap, it's retaining 
> ~280MB of memory and increasing slowly.
> {{LRUQueryCache.cache.size}} was at 12,099, and 
> {{LRUQueryCache.cache.modCount}} was also 12,099, meaning nothing was removed 
> from {{LRUQueryCache.cache}} at all.
> The keys of {{LRUQueryCache.cache}} are instances of {{SegmentCoreReaders}}, 
> and I've checked many of the keys, the only reference to them is 
> {{LRUQueryCache.cache}}, given {{LRUQueryCache.cache}} is an 
> {{IdentityHashMap}}, that means you can't even get to them outside of the 
> cache because you can't get a key that's equivalent to one of these in the 
> cache.
> This affectively makes {{IndexSearcher.DEFAULT_QUERY_CACHE}} a memory black 
> hole.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to