我有一个基于Lucene自定义实现的搜索引擎,不幸的是我仍然使用Lucene 3.0.3而且由于超出此问题范围的原因我无法更改它。 现在我需要从Java 6迁移到Java 8,但是当我使用Java 8 JVM运行索引时,我点击了#34;太多的打开文件问题"如下:
java.io.FileNotFoundException: /myIndex/_27c.fdx (Too many open files)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:333)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:257)
at org.apache.lucene.store.SimpleFSDirectory$SimpleFSIndexOutput.<init>(SimpleFSDirectory.java:180)
at org.apache.lucene.store.NIOFSDirectory.createOutput(NIOFSDirectory.java:85)
at org.apache.lucene.index.FieldsWriter.<init>(FieldsWriter.java:86)
at org.apache.lucene.index.StoredFieldsWriter.initFieldsWriter(StoredFieldsWriter.java:66)
at org.apache.lucene.index.StoredFieldsWriter.finishDocument(StoredFieldsWriter.java:144)
at org.apache.lucene.index.StoredFieldsWriter$PerDoc.finish(StoredFieldsWriter.java:192)
at org.apache.lucene.index.DocumentsWriter$WaitQueue.writeDocument(DocumentsWriter.java:1559)
at org.apache.lucene.index.DocumentsWriter$WaitQueue.add(DocumentsWriter.java:1578)
at org.apache.lucene.index.DocumentsWriter.finishDocument(DocumentsWriter.java:1155)
at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:832)
at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:807)
at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:2155)
我系统上的ulimit是80.000个文件,当我运行lsof时,我知道打开的文件属于索引,它们被标记为(已删除)段。 我知道有很多关于Lucene打开文件问题的问题,答案和博客,但是:
之前有人遇到过java 8这个问题吗?关于如何进一步解决这个问题或可能是什么原因的任何其他想法?