lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1458127 - in /lucene/dev/branches/lucene_solr_4_2: ./ dev-tools/ lucene/ lucene/analysis/ lucene/analysis/icu/src/java/org/apache/lucene/collation/ lucene/backwards/ lucene/benchmark/ lucene/classification/ lucene/classification/src/ lucen...
Date Tue, 19 Mar 2013 04:30:40 GMT
Author: markrmiller
Date: Tue Mar 19 04:30:38 2013
New Revision: 1458127

URL: http://svn.apache.org/r1458127
Log:
SOLR-4595: CachingDirectoryFactory#close can throw a concurrent modification exception.

Modified:
    lucene/dev/branches/lucene_solr_4_2/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/dev-tools/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/BUILD.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/CHANGES.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/JRE_VERSION_MIGRATION.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/LICENSE.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/MIGRATE.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/NOTICE.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/README.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/SYSTEM_REQUIREMENTS.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/analysis/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationKeyFilterFactory.java
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/backwards/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/benchmark/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/build.xml   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/classification/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/classification/build.xml   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/classification/ivy.xml   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/classification/src/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/codecs/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/common-build.xml   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/index/index.40.cfs.zip
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/index/index.40.nocfs.zip
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.cfs.zip
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.nocfs.zip
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/search/TestSort.java
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/search/TestSortDocValues.java
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/search/TestSortRandom.java
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/core/src/test/org/apache/lucene/search/TestTotalHitCountCollector.java
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/demo/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/facet/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/grouping/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/highlighter/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/ivy-settings.xml   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/join/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/licenses/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/memory/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/misc/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/module-build.xml   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/queries/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/queryparser/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/sandbox/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/site/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/spatial/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/suggest/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/test-framework/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/lucene/tools/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/LICENSE.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/NOTICE.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/README.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/SYSTEM_REQUIREMENTS.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/build.xml   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/cloud-dev/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/common-build.xml   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/contrib/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/core/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
    lucene/dev/branches/lucene_solr_4_2/solr/core/src/test/org/apache/solr/core/CachingDirectoryFactoryTest.java
    lucene/dev/branches/lucene_solr_4_2/solr/core/src/test/org/apache/solr/core/TestConfig.java
  (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/example/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/licenses/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/licenses/httpclient-LICENSE-ASL.txt   (props
changed)
    lucene/dev/branches/lucene_solr_4_2/solr/licenses/httpclient-NOTICE.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/licenses/httpcore-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/licenses/httpcore-NOTICE.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/licenses/httpmime-LICENSE-ASL.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/licenses/httpmime-NOTICE.txt   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/scripts/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/site/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/solrj/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/test-framework/   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/testlogging.properties   (props changed)
    lucene/dev/branches/lucene_solr_4_2/solr/webapp/   (props changed)

Modified: lucene/dev/branches/lucene_solr_4_2/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_2/solr/CHANGES.txt?rev=1458127&r1=1458126&r2=1458127&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_2/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_4_2/solr/CHANGES.txt Tue Mar 19 04:30:38 2013
@@ -76,6 +76,9 @@ Bug Fixes
 * SOLR-4592: DefaultSolrCoreState#doRecovery needs to check the CoreContainer
   shutdown flag inside the recoveryLock sync block. (Mark Miller)
 
+* SOLR-4595: CachingDirectoryFactory#close can throw a concurrent 
+  modification exception. (Mark Miller)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/lucene_solr_4_2/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_2/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java?rev=1458127&r1=1458126&r2=1458127&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_2/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
(original)
+++ lucene/dev/branches/lucene_solr_4_2/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
Tue Mar 19 04:30:38 2013
@@ -20,6 +20,7 @@ package org.apache.solr.core;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
@@ -124,7 +125,9 @@ public abstract class CachingDirectoryFa
   public void close() throws IOException {
     synchronized (this) {
       this.closed = true;
-      for (CacheValue val : byDirectoryCache.values()) {
+      Collection<CacheValue> values = new ArrayList<CacheValue>();
+      values.addAll(byDirectoryCache.values());
+      for (CacheValue val : values) {
         try {
           // if there are still refs out, we have to wait for them
           int cnt = 0;
@@ -136,7 +139,15 @@ public abstract class CachingDirectoryFa
               break;
             }
           }
-          
+          assert val.refCnt == 0 : val.refCnt;
+        } catch (Throwable t) {
+          SolrException.log(log, "Error closing directory", t);
+        }
+      }
+      
+      values = byDirectoryCache.values();
+      for (CacheValue val : values) {
+        try {
           assert val.refCnt == 0 : val.refCnt;
           log.info("Closing directory when closing factory: " + val.path);
           closeDirectory(val);
@@ -144,6 +155,7 @@ public abstract class CachingDirectoryFa
           SolrException.log(log, "Error closing directory", t);
         }
       }
+      
       byDirectoryCache.clear();
       byPathCache.clear();
     }

Modified: lucene/dev/branches/lucene_solr_4_2/solr/core/src/test/org/apache/solr/core/CachingDirectoryFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_2/solr/core/src/test/org/apache/solr/core/CachingDirectoryFactoryTest.java?rev=1458127&r1=1458126&r2=1458127&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_2/solr/core/src/test/org/apache/solr/core/CachingDirectoryFactoryTest.java
(original)
+++ lucene/dev/branches/lucene_solr_4_2/solr/core/src/test/org/apache/solr/core/CachingDirectoryFactoryTest.java
Tue Mar 19 04:30:38 2013
@@ -73,6 +73,17 @@ public class CachingDirectoryFactoryTest
       thread.join();
     }
     
+    Thread thread = new Thread() {
+      public void run() {
+        try {
+          df.close();
+        } catch (IOException e) {
+          throw new RuntimeException(e);
+        }
+      }
+    };
+    thread.start();
+    
     // do any remaining releases
     synchronized (dirs) {
       int sz = dirs.size();
@@ -98,7 +109,8 @@ public class CachingDirectoryFactoryTest
       
     }
     
-    df.close();
+    thread.join();
+
   }
   
   private class ReleaseDirThread extends Thread {



Mime
View raw message