lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <>
Subject Re: Lucene not closing an IndexOutput when writing?
Date Wed, 09 Dec 2015 11:26:37 GMT
Hi Trejkaz,

Lucene holds this file handle open for a long time, since term vectors
are appended "live" to this file as the documents are indexed, v.s.
e.g. postings where all buffering is in RAM until it's time to write a
segment at which point we open the output, write stuff, close it.

That said, Lucene tries hard to close this file handle, e.g. if an
in-memory segment is aborted because of e.g. an interrupt exception at
a bad time.

So, yes, please try to make a test showing that we failed to close it!
 That's a bad bug if so ... we should never leak file handles.

Mike McCandless

On Tue, Dec 8, 2015 at 7:36 PM, Trejkaz <> wrote:
> We have a Directory implementation that keeps track of who doesn't
> close their IndexInput and IndexOutput.
> In some test which is attempting to index documents and ultimately
> timed out for other reasons (presumably triggering an interrupt,
> admittedly not the sort of thing libraries are usually very good at
> handling), it records that the following stack opened an IndexOutput
> but didn't close it:
>     java.lang.RuntimeException: unclosed IndexOutput: _0.tvx
>         at
>         at
>         at
>         at org.apache.lucene.codecs.compressing.CompressingTermVectorsWriter.<init>(
>         at org.apache.lucene.codecs.compressing.CompressingTermVectorsFormat.vectorsWriter(
>         at org.apache.lucene.index.TermVectorsConsumer.initTermVectorsWriter(
>         at org.apache.lucene.index.TermVectorsConsumer.finishDocument(
>         at org.apache.lucene.index.TermsHash.finishDocument(
>         at org.apache.lucene.index.DefaultIndexingChain.processDocument(
>         at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(
>         at org.apache.lucene.index.DocumentsWriter.updateDocument(
>         at org.apache.lucene.index.IndexWriter.updateDocument(
>         at org.apache.lucene.index.IndexWriter.addDocument(
> This is in v5.2.1.
> I don't know if this is worth a bug record yet, but I thought I would
> ask where this is *supposed* to be closed, so that I can try to make a
> more direct test and maybe catch it in the act.
> TX
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message