lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject [lucene-solr] 07/11: @660 Harden leak.
Date Tue, 01 Sep 2020 13:06:17 GMT
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 9d9239b47f2c02ca279bcee56352eb00870a2edd
Author: markrmiller@gmail.com <markrmiller@gmail.com>
AuthorDate: Mon Aug 31 16:32:20 2020 -0500

    @660 Harden leak.
---
 solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java | 2 +-
 solr/core/src/java/org/apache/solr/core/SolrCore.java                | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java b/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
index 824a569..8e20891 100644
--- a/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
+++ b/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
@@ -260,7 +260,7 @@ public abstract class CachingDirectoryFactory extends DirectoryFactory
{
     }
   }
 
-  private void removeFromCache(CacheValue v) {
+  private synchronized void removeFromCache(CacheValue v) {
     if (log.isDebugEnabled()) {
       log.debug("removeFromCache(CacheValue v={}) - start", v);
     }
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index bf417aa..8fbc2dd 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -80,6 +80,7 @@ import org.apache.solr.client.solrj.impl.BinaryResponseParser;
 import org.apache.solr.cloud.CloudDescriptor;
 import org.apache.solr.cloud.RecoveryStrategy;
 import org.apache.solr.cloud.ZkSolrResourceLoader;
+import org.apache.solr.common.AlreadyClosedException;
 import org.apache.solr.common.ParWork;
 import org.apache.solr.common.ParWorkExecutor;
 import org.apache.solr.common.SolrException;
@@ -2265,6 +2266,9 @@ public final class SolrCore implements SolrInfoBean, Closeable {
    * @param updateHandlerReopens if true, the UpdateHandler will be used when reopening a
{@link SolrIndexSearcher}.
    */
   public RefCounted<SolrIndexSearcher> getSearcher(boolean forceNew, boolean returnSearcher,
@SuppressWarnings({"rawtypes"})final Future[] waitSearcher, boolean updateHandlerReopens)
{
+    if (isClosed) {
+      throw new AlreadyClosedException();
+    }
     // it may take some time to open an index.... we may need to make
     // sure that two threads aren't trying to open one at the same time
     // if it isn't necessary.


Mime
View raw message