# org.apache.lucene.index.CorruptIndexException: checksum failed

**URL:** <https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856>\
**Category:** Elasticsearch\
**Created:** [July 19, 2016, 10:30am UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856 "2016-07-19T10:30:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![suiyuan2009](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suiyuan2009/32/10962_2.png) [@suiyuan2009](https://discuss.elastic.co/u/suiyuan2009)\
**Post date:** [July 19, 2016, 10:30am UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856/1 "2016-07-19T10:30:51Z")

</div>

I use ubuntu to run lucene(not ES), and nfs to mount disk(actually is rocketstor) of macmini. I get this error constantly. I have already used `org.apache.lucene.index.CheckIndex`, but will still crash after restart program.

```
Exception in thread "main" org.apache.lucene.store.AlreadyClosedException: this IndexWriter is closed
        at org.apache.lucene.index.IndexWriter.ensureOpen(IndexWriter.java:724)
        at org.apache.lucene.index.IndexWriter.ensureOpen(IndexWriter.java:738)
        at org.apache.lucene.index.IndexWriter.numDocs(IndexWriter.java:1198)
        at xxxx.xxxxx.search.XxxxxxxxIndexer.close(XxxxxxxxIndexer.java:184)
        at xxxx.xxxxx.search.ThreadedXxxxxxxxIndexer.close(ThreadedXxxxxxxxIndexer.java:59)
        at xxxx.xxxxx.search.ThreadedXxxxxxxxIndexer.main(ThreadedXxxxxxxxIndexer.java:136)

Caused by: org.apache.lucene.index.CorruptIndexException: checksum failed (hardware problem?) : expected=51fbdb5c actual=6e964d17 (resource=BufferedChecksumIndexInput(MMapIndexInput(path="/mnt/HPT8_56T/xxxxxxxxx-index/index1/_mq.cfs") [slice=_mq_Lucene50_0.pos]))
        at org.apache.lucene.codecs.CodecUtil.checkFooter(CodecUtil.java:365)
        at org.apache.lucene.codecs.CodecUtil.checksumEntireFile(CodecUtil.java:469)
        at org.apache.lucene.codecs.lucene50.Lucene50PostingsReader.checkIntegrity(Lucene50PostingsReader.java:1286)
        at org.apache.lucene.codecs.blocktree.BlockTreeTermsReader.checkIntegrity(BlockTreeTermsReader.java:336)
        at org.apache.lucene.codecs.perfield.PerFieldPostingsFormat$FieldsReader.checkIntegrity(PerFieldPostingsFormat.java:317)
        at org.apache.lucene.codecs.FieldsConsumer.merge(FieldsConsumer.java:96)
        at org.apache.lucene.index.SegmentMerger.mergeTerms(SegmentMerger.java:211)
        at org.apache.lucene.index.SegmentMerger.merge(SegmentMerger.java:96)
        at org.apache.lucene.index.IndexWriter.mergeMiddle(IndexWriter.java:4099)
        at org.apache.lucene.index.IndexWriter.merge(IndexWriter.java:3679)
        at org.apache.lucene.index.ConcurrentMergeScheduler.doMerge(ConcurrentMergeScheduler.java:588)
        at org.apache.lucene.index.ConcurrentMergeScheduler$MergeThread.run(ConcurrentMergeScheduler.java:626)
```

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [July 19, 2016, 11:06am UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856/2 "2016-07-19T11:06:16Z")

</div>

Don't use NFS with Elasticsearch.

---

<div class="post-metadata">

**Author:** ![suiyuan2009](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suiyuan2009/32/10962_2.png) [@suiyuan2009](https://discuss.elastic.co/u/suiyuan2009)\
**Post date:** [July 19, 2016, 11:07am UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856/3 "2016-07-19T11:07:50Z")

</div>

I only use lucene, not ES, maybe nfs is the problem.

---

<div class="post-metadata">

**Author:** ![suiyuan2009](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suiyuan2009/32/10962_2.png) [@suiyuan2009](https://discuss.elastic.co/u/suiyuan2009)\
**Post date:** [July 19, 2016, 2:45pm UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856/4 "2016-07-19T14:45:32Z")

</div>

what's exactly the problem of nfs?

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [July 19, 2016, 4:43pm UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856/5 "2016-07-19T16:43:58Z")

</div>

If you delete files over NFS, they may result in stale file handles. This is common while indexing and segment files are created and deleted.

If NFS is shared between two or more writing clients, Lucene might get confused regarding locking.  
You can use a Lucene index only by one JVM.

You can not use memory mapped mmapfs store, only simplefs store. [https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-store.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-store.html)

Also, in general, NFS is very slow, if you store data, they must unmap from memory and sent over the NFS wire to the target file system before being written. The NFS read/writes are buffered on their own and can not make use of ES/Lucene buffer acceleration of the mmapfs store. This can be a factor of 5-10x slower.

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [July 19, 2016, 4:50pm UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856/6 "2016-07-19T16:50:50Z")

</div>

@suiyuan2009 Perhaps you'd be better off asking in one of the Lucene mailing lists? These forums are mainly to support Elasticsearch or ES-related issues, so we can't really help you much with direct Lucene questions.

[https://lucene.apache.org/core/discussion.html](https://lucene.apache.org/core/discussion.html)

Also echoing the sentiments to not use NFS 🙂

---

<div class="post-metadata">

**Author:** ![suiyuan2009](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suiyuan2009/32/10962_2.png) [@suiyuan2009](https://discuss.elastic.co/u/suiyuan2009)\
**Post date:** [July 20, 2016, 7:58am UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856/7 "2016-07-20T07:58:54Z")

</div>

thank you, I will use nfs noac option to see if it's the nfs cache problem

---

<div class="post-metadata">

**Author:** ![suiyuan2009](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suiyuan2009/32/10962_2.png) [@suiyuan2009](https://discuss.elastic.co/u/suiyuan2009)\
**Post date:** [July 20, 2016, 7:59am UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856/8 "2016-07-20T07:59:51Z")

</div>

thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:34pm UTC](https://discuss.elastic.co/t/org-apache-lucene-index-corruptindexexception-checksum-failed/55856/9 "2017-07-05T22:34:09Z")

</div>


