Apache Lucene open-source search software
SOLR-5460: SolrDispatchFilter#sendError can get a SolrCore that it does not close.
Mark Robert Millerd88ee060b562
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex e3a1bc4098f..ae44a74325a 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -110,6 +110,9 @@ Bug Fixes* SOLR-5452: Do not attempt to proxy internal update requests. (Mark Miller)+* SOLR-5460: SolrDispatchFilter#sendError can get a SolrCore that it does not+ close. (Mark Miller)+Other Changes---------------------diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.javaindex 57213215f67..505f5ee2d29 100644--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java@@ -722,6 +722,7 @@ public class SolrDispatchFilter implements FilterServletRequest request,HttpServletResponse response,Throwable ex) throws IOException {+ SolrCore localCore = null;try {SolrQueryResponse solrResp = new SolrQueryResponse();if(ex instanceof Exception) {@@ -731,7 +732,9 @@ public class SolrDispatchFilter implements FiltersolrResp.setException(new RuntimeException(ex));}if(core==null) {- core = cores.getCore(""); // default core+ localCore = cores.getCore(""); // default core+ } else {+ localCore = core;}if(req==null) {final SolrParams solrParams;@@ -751,6 +754,10 @@ public class SolrDispatchFilter implements FilterSimpleOrderedMap info = new SimpleOrderedMap();int code = ResponseUtils.getErrorInfo(ex, info, log);response.sendError( code, info.toString() );+ } finally {+ if (core == null && localCore != null) {+ localCore.close();+ }}}