You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/08/30 15:52:32 UTC
[lucene-solr] branch reference_impl updated: @632 Try to harden our
dir release, somehow this can leak.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/reference_impl by this push:
new c880f3e @632 Try to harden our dir release, somehow this can leak.
c880f3e is described below
commit c880f3e384f99ec21d6792673d9fe0b0ccb4e3bb
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Aug 30 10:48:49 2020 -0500
@632 Try to harden our dir release, somehow this can leak.
---
.../apache/solr/handler/ReplicationHandler.java | 23 ++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
index 65c72a8..46fe2bc 100644
--- a/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
@@ -1170,6 +1170,8 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
Properties loadReplicationProperties() {
Directory dir = null;
try {
+ InputStreamReader isr = null;
+ InputStream is = null;
try {
dir = core.getDirectoryFactory().get(core.getDataDir(),
DirContext.META_DATA, core.getSolrConfig().indexConfig.lockType);
@@ -1182,17 +1184,26 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
}
try {
- final InputStream is = new PropertiesInputStream(input);
+ is = new PropertiesInputStream(input);
Properties props = new Properties();
- props.load(new InputStreamReader(is, StandardCharsets.UTF_8));
+ isr = new InputStreamReader(is, StandardCharsets.UTF_8);
+ props.load(isr);
return props;
} finally {
- input.close();
+ org.apache.solr.common.util.IOUtils.closeQuietly(input);
}
} finally {
- if (dir != null) {
- core.getDirectoryFactory().doneWithDirectory(dir);
- core.getDirectoryFactory().release(dir);
+ try {
+ if (dir != null) {
+ try {
+ core.getDirectoryFactory().doneWithDirectory(dir);
+ } finally {
+ core.getDirectoryFactory().release(dir);
+ }
+ }
+ } finally {
+ org.apache.solr.common.util.IOUtils.closeQuietly(isr);
+ org.apache.solr.common.util.IOUtils.closeQuietly(is);
}
}
} catch (IOException e) {