lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "gabriele renzi (JIRA)" <>
Subject [jira] Created: (SOLR-1538) Solr possible deadlock source (FindBugs report)
Date Sun, 01 Nov 2009 11:52:59 GMT
Solr possible deadlock source (FindBugs report)

                 Key: SOLR-1538
             Project: Solr
          Issue Type: Bug
    Affects Versions: 1.4
         Environment: platform independent
            Reporter: gabriele renzi
            Priority: Minor

The code to get the latest accessed items in ConcurrentLRUCache looks like

 public Map<K, V> getOldestAccessedItems(int n) {
    Map<K, V> result = new LinkedHashMap<K, V>();
    TreeSet<CacheEntry> tree = new TreeSet<CacheEntry>();
    try {
    } finally {

(this method is apparently unused though) and in 

   public Map<K,V> getLatestAccessedItems(int n) {
     // we need to grab the lock since we are changing lastAccessedCopy
     Map<K,V> result = new LinkedHashMap<K,V>();
     TreeSet<CacheEntry> tree = new TreeSet<CacheEntry>();
     try {

The impression is that if an OOM situation occurs on the allocation of the local LinkedHashMap
and TreeSet the lock would not be unlocked anymore.
The quick fix would be to move the lock() call after the allocations, and this does not seem
to imply any problem. 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message