This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_9x in repository https://gitbox.apache.org/repos/asf/solr.git
commit 6ab6af7ab36d9fdebc0cafe088b0f63fb65f1f73 Author: Jason Gerlowski <[email protected]> AuthorDate: Mon Nov 9 15:46:22 2026 -0500 SOLR-18551: Prevent mmap leak in IndexFetcher (#5173) (cherry picked from commit d915b840fbb5d5aa5c88e9ef1814bbefa123841e) (cherry picked from commit c1664496476f58ee7a1b975eb69341a47331c335) --- .../unreleased/SOLR-18551-avoid-mmap-leak-in-indexfetcher.yml | 10 ++++++++++ solr/core/src/java/org/apache/solr/handler/IndexFetcher.java | 10 +++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/changelog/unreleased/SOLR-18551-avoid-mmap-leak-in-indexfetcher.yml b/changelog/unreleased/SOLR-18551-avoid-mmap-leak-in-indexfetcher.yml new file mode 100644 index 00000000000..c8e30f401e4 --- /dev/null +++ b/changelog/unreleased/SOLR-18551-avoid-mmap-leak-in-indexfetcher.yml @@ -0,0 +1,10 @@ +title: > + Fix mmap and virtual-memory leak in IndexFetcher +type: fixed +authors: + - name: Jason Gerlowski +links: + - name: SOLR-18551 + url: https://issues.apache.org/jira/browse/SOLR-18551 + - name: Lucene Bug Report + url: https://github.com/apache/lucene/issues/15068 diff --git a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java index 7c77a599492..9806561a41e 100644 --- a/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java +++ b/solr/core/src/java/org/apache/solr/handler/IndexFetcher.java @@ -1382,12 +1382,16 @@ public class IndexFetcher { } /** - * Returns true if the file exists (can be opened), false if it cannot be opened, and (unlike - * Java's File.exists) throws IOException if there's some unexpected error. + * Returns true if the file exists (as judged by a length check not throwing an error) and false + * otherwise. + * + * @throws IOException in the case of any unexpected (non "not found") I/O error */ private static boolean slowFileExists(Directory dir, String fileName) throws IOException { try { - dir.openInput(fileName, IOContext.DEFAULT).close(); + // We don't care about the length, just the existence check that will occur implicitly when + // checking length. + dir.fileLength(fileName); return true; } catch (NoSuchFileException | FileNotFoundException e) { return false;
