lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Uwe Schindler <>
Subject Re: “Too many open files" error hit when I run my Lucene 3.0.3 application on Java 8
Date Wed, 22 Feb 2017 16:49:31 GMT
The garbage collector in Java 8 may have different behavior. This may cause issues if you have
buggy code that does not close indexreaders open in parallel to indexing. If it relies on
Garbage Collector to close accidentally open files, that won't work anymore on Java 8. The
reason for this might be changes to the finalists of Random access files in this issue for
Java 7:

Please make sure that you close all IndexWriters and IndexReaders after use, so cleanup does
not rely on GC. 

I am also not sure if there are bugs in this old Lucene version that might fail to close all
streams correctly. This may cause these issues in combination with the above fixes in Java


Am 22. Februar 2017 17:27:48 MEZ schrieb Leonid Bolshinsky <>:
>No code changes between running in Java 6 and Java 8. The same code
>runs successfully with Java 6 while is failing with Java 8.
>On Feb 22, 2017 5:52 PM, "Frederik Van Hoyweghen" <
>> wrote:
>Did you make any changes to your code between running on java 6 and 8?
>The java file API has changed considerably since java 8.
>If you -have- rewritten some of the file handling code in your indexing
>process, make sure to explicitly close the streams you create, or use
>(since java 7) try-with-resources construct.
>On 22/02/2017 16:18, Leonid Bolshinsky wrote:
>> I have a search engine based on Lucene 3.0.3 and I can't change the
>> version for reasons that are out of scope of this question. Now I
>have a
>> requirement to move from Java 6 to Java 8, however when I run the
>> using Java 8 JVM, I hit "Too many open files issue" as below:
>> /myIndex/_27c.fdx (Too many open
>>      at Method)
>>      at
>>      at<init>(
>>      at$SimpleFSIndexOutpu
>> t.<init>(
>>      at
>>      at
>>      at org.apache.lucene.index.StoredFieldsWriter.initFieldsWriter(
>>      at org.apache.lucene.index.StoredFieldsWriter.finishDocument(St
>>      at org.apache.lucene.index.StoredFieldsWriter$PerDoc.finish(
>>      at org.apache.lucene.index.DocumentsWriter$WaitQueue.writeDocum
>> ent(
>>      at org.apache.lucene.index.DocumentsWriter$WaitQueue.add(Docume
>>      at org.apache.lucene.index.DocumentsWriter.finishDocument(Docum
>>      at org.apache.lucene.index.DocumentsWriter.updateDocument(Docum
>>      at org.apache.lucene.index.DocumentsWriter.updateDocument(Docum
>>      at org.apache.lucene.index.IndexWriter.updateDocument(IndexWrit
>> The ulimit on my system is 80.000 files and when I run lsof, I get
>that the
>> open files belong to the index and they are marked as (deleted)
>segments. I
>> am aware that there are tons of questions, answers and blogs about
>> Lucene open files issue, however:
>>     - I've already tried whatever is recommended (review the code
>>     for open IndexWriters, increase ulimit, enable compound mode,
>> the
>>     number of segments from 10 to 4, review the code for open files)
>> without
>>     success and
>>     - The issue didn't appear with Java 6 so I am guessing that the
>>     is in how Java 8 handles files.
>> Anybody faced this issue with Java 8 before? Any additional idea
>about how
>> to further troubleshoot this issue or what could be the cause?
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Uwe Schindler
Achterdiek 19, 28357 Bremen
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message