Skip to content

Commit aaefbde

Browse files
committed
Fix memory leak
This occurs when slave nodes harvest the master nodes, while the master node is harvesting. The TaxonomyReader is never closed, which results in high memory consumption. I could not find any usage in the code where closing the TaxonomyReader would result in any issues.
1 parent c3c3339 commit aaefbde

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

core/src/main/java/org/fao/geonet/kernel/search/IndexAndTaxonomy.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public IndexAndTaxonomy(long version, GeonetworkMultiReader indexReader, Taxonom
4444
@Override
4545
public void close() throws IOException {
4646
indexReader.releaseToNRTManager();
47-
//TODO: this has a taxonomyReader in it, and it should be "closed" (decrement a ref)
48-
// However, since it's public, not sure if we can do that or not since someone else might be using it...
47+
taxonomyReader.close();
4948
}
5049
}

core/src/main/java/org/fao/geonet/kernel/search/SearchManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ public IndexAndTaxonomy getNewIndexReader(String preferredLang) throws IOExcepti
12081208
}
12091209

12101210
public void releaseIndexReader(IndexAndTaxonomy reader) throws InterruptedException, IOException {
1211-
reader.indexReader.releaseToNRTManager();
1211+
reader.close();
12121212
}
12131213

12141214
/**

0 commit comments

Comments
 (0)