You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2014/11/04 16:21:58 UTC
svn commit: r1636604 - in /lucene/dev/branches/branch_5x: ./ solr/
solr/CHANGES.txt solr/core/
solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
solr/core/src/java/org/apache/solr/core/SolrCore.java
Author: shalin
Date: Tue Nov 4 15:21:58 2014
New Revision: 1636604
URL: http://svn.apache.org/r1636604
Log:
SOLR-2927: Solr does not unregister all mbeans upon exception in constructor causing memory leaks
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/solr/core/ (props changed)
lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrCore.java
Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1636604&r1=1636603&r2=1636604&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Tue Nov 4 15:21:58 2014
@@ -257,6 +257,8 @@ Bug Fixes
* SOLR-6631: DistributedQueue spinning on calling zookeeper getChildren()
(Jessica Cheng Mallet, Mark Miller, Timothy Potter)
+* SOLR-2927: Solr does not unregister all mbeans upon exception in constructor
+ causing memory leaks. (tom liu, Sharath Babu, Cyrille Roy, shalin)
Optimizations
----------------------
Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java?rev=1636604&r1=1636603&r2=1636604&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java Tue Nov 4 15:21:58 2014
@@ -112,8 +112,16 @@ public class JmxMonitoredMap<K, V> exten
@Override
public void clear() {
if (server != null) {
- for (Map.Entry<String, SolrInfoMBean> entry : entrySet()) {
- unregister(entry.getKey(), entry.getValue());
+ QueryExp exp = Query.eq(Query.attr("coreHashCode"), Query.value(coreHashCode));
+ Set<ObjectName> objectNames = server.queryNames(null, exp);
+ if (objectNames != null) {
+ for (ObjectName name : objectNames) {
+ try {
+ server.unregisterMBean(name);
+ } catch (Exception e) {
+ LOG.error("Exception un-registering mbean {}", name, e);
+ }
+ }
}
}
Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1636604&r1=1636603&r2=1636604&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/core/SolrCore.java Tue Nov 4 15:21:58 2014
@@ -1065,14 +1065,6 @@ public final class SolrCore implements S
}
- try {
- infoRegistry.clear();
- } catch (Throwable e) {
- SolrException.log(log, e);
- if (e instanceof Error) {
- throw (Error) e;
- }
- }
try {
if (null != updateHandler) {
@@ -1125,6 +1117,15 @@ public final class SolrCore implements S
throw (Error) e;
}
}
+
+ try {
+ infoRegistry.clear();
+ } catch (Throwable e) {
+ SolrException.log(log, e);
+ if (e instanceof Error) {
+ throw (Error) e;
+ }
+ }
if (coreStateClosed) {