SOLR-2793: In rare cases (most likely during shutdown), a SolrIndexSearcher can be left open if the executor rejects a task.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1175637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2011-09-26 00:48:02 +00:00
parent e7229ee7a4
commit 50b31b2a4e
2 changed files with 27 additions and 18 deletions

View File

@ -368,6 +368,9 @@ Bug Fixes
* SOLR-2780: Fixed issue where multi select facets didn't respect group.truncate parameter.
(Martijn van Groningen, Ramzi Alqrainy)
* SOLR-2793: In rare cases (most likely during shutdown), a SolrIndexSearcher can be left
open if the executor rejects a task. (Mark Miller)
Other Changes
----------------------

View File

@ -1245,26 +1245,32 @@ public final class SolrCore implements SolrInfoMBean {
// queued will finish first).
final RefCounted<SolrIndexSearcher> currSearcherHolderF = currSearcherHolder;
if (!alreadyRegistered) {
future = searcherExecutor.submit(
new Callable() {
public Object call() throws Exception {
try {
// signal that we no longer need to decrement
// the count *before* registering the searcher since
// registerSearcher will decrement even if it errors.
decrementOnDeckCount[0]=false;
registerSearcher(newSearchHolder);
} catch (Throwable e) {
SolrException.logOnce(log,null,e);
} finally {
// we are all done with the old searcher we used
// for warming...
if (currSearcherHolderF!=null) currSearcherHolderF.decref();
try {
future = searcherExecutor.submit(
new Callable() {
public Object call() throws Exception {
try {
// signal that we no longer need to decrement
// the count *before* registering the searcher since
// registerSearcher will decrement even if it errors.
decrementOnDeckCount[0]=false;
registerSearcher(newSearchHolder);
} catch (Throwable e) {
SolrException.logOnce(log,null,e);
} finally {
// we are all done with the old searcher we used
// for warming...
if (currSearcherHolderF!=null) currSearcherHolderF.decref();
}
return null;
}
return null;
}
}
);
);
} catch(Exception e) {
// if submit fails, newSearchHolder does not get decref'd
if (newSearchHolder != null) newSearchHolder.decref();
throw e;
}
}
if (waitSearcher != null) {