You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Dawid Weiss (Jira)" <ji...@apache.org> on 2019/12/18 13:58:00 UTC

[jira] [Resolved] (LUCENE-8494) CFS leaks a file on exception opening it

     [ https://issues.apache.org/jira/browse/LUCENE-8494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dawid Weiss resolved LUCENE-8494.
---------------------------------
    Resolution: Cannot Reproduce

> CFS leaks a file on exception opening it
> ----------------------------------------
>
>                 Key: LUCENE-8494
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8494
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/codecs
>            Reporter: Robert Muir
>            Priority: Major
>
> If CFS hits an exception opening its file, it will leak the file handle. Found by Jenkins: https://jenkins.thetaphi.de/job/Lucene-Solr-7.x-Solaris/808/
> {noformat}
>  java.lang.RuntimeException: MockDirectoryWrapper: cannot close: there are still 7 open files: {_j.cfs=1, _h.cfs=1, _e.cfs=1, _g.cfs=1, _i.cfs=1, _k.cfs=1, _f.cfs=1}
> ...
> Caused by: java.lang.RuntimeException: unclosed IndexInput: _f.cfs
>         at org.apache.lucene.store.MockDirectoryWrapper.addFileHandle(MockDirectoryWrapper.java:730)
>         at org.apache.lucene.store.MockDirectoryWrapper.openInput(MockDirectoryWrapper.java:773)
>         at org.apache.lucene.codecs.lucene50.Lucene50CompoundReader.<init>(Lucene50CompoundReader.java:78)
> {noformat}
> Looks like it needs to move opening of {{handle}} into the try block (untested):
> {noformat}
> diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundReader.java
> index 7526c88c20..db54ecdee2 100644
> --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundReader.java
> +++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundReader.java
> @@ -75,8 +75,8 @@ final class Lucene50CompoundReader extends Directory {
>      }
>      expectedLength += CodecUtil.footerLength(); 
>  
> -    handle = directory.openInput(dataFileName, context);
>      try {
> +      handle = directory.openInput(dataFileName, context);
>        CodecUtil.checkIndexHeader(handle, Lucene50CompoundFormat.DATA_CODEC, version, version, si.getId(), "");
>        
>        // NOTE: data file is too costly to verify checksum against all the bytes on open,
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org