[
https://issues.apache.org/jira/browse/SOLR-6678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14190512#comment-14190512
]
Hoss Man commented on SOLR-6678:
--------------------------------
A quick skimming the code, and i _think_ the problem here is the CloseHook in
SolrSuggester is an anonymous object - so it's keeping a ref to the
SolrSuggester (and everything it keeps a ref too)...
{code}
core.addCloseHook(new CloseHook() {
@Override
public void preClose(SolrCore core) {
if (lookup != null && lookup instanceof Closeable) {
try {
((Closeable) lookup).close();
} catch (IOException e) {
LOG.warn("Could not close the suggester lookup.", e);
}
}
}
@Override
public void postClose(SolrCore core) {}
});
{code}
if we make that it's own private static inner (named) class, it won't keep a
refrence to the SolrSuggester -- it just needs a constructor that takes in the
Lookup object.
i _think_ that would solve the problem
----
actually -- i should probably just be replaced by a top level public
"PreCloseClosableHook" class that can likeley be reused in other places in the
code base...
{code}
public class PreCloseClosableHook implements CloseHook {
final Closable toClose;
final String label;
public PreCloseClosableHook(String label, Closable toClose) {
this.toClose = toClose;
this.label = label;
}
@Override
public void preClose(SolrCore core) {
try {
toClose.close();
} catch (Exception e) {
LOG.error("Could not close " + label, e);
}
}
}
{code}
> Collection/core reload is causing a memory leak
> -----------------------------------------------
>
> Key: SOLR-6678
> URL: https://issues.apache.org/jira/browse/SOLR-6678
> Project: Solr
> Issue Type: Bug
> Affects Versions: 4.10
> Reporter: Alexey Serba
> Attachments: ReloadMemoryLeak.png
>
>
> I have a use case where I need to periodically
> [reload|https://cwiki.apache.org/confluence/display/solr/Collections+API#CollectionsAPI-api2]
> a SolrCloud collection. Recently I did ~1k reload operations and noticed
> that the cluster was running slower and slower, so I connected to it with
> jconsole and noticed that heap was growing with every reload operation,
> forcing GC wasn't helping.
> So I took a heap dump and noticed that I have too many SolrCore-s hanging
> around.
> It's hard for me to grok the root cause of this, but maybe someone more
> knowledgable in Solr internals can figure it out by looking into this GC root
> path (see attached image)? If I interpret this correctly, it looks like one
> SolrCore is referencing another SolrCore through SolrSuggester. Maybe close
> hook for SolrSuggester component doesn't release everything that it should be
> releasing (like SolrSuggester.dictionary)?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]