Some code interrupted (Thread.interrupt) a java thread while it was blocked on I/O. This is not safe to do with lucene, because unfortunately in this situation java's NIO code closes file descriptors and releases locks.
The second exception is because the indexwriter tried to write when it no longer actually held the lock. See the "NOTE" at the beginning of NIOFSDirectory and MMapDirectory's javadocs for more information: https://lucene.apache.org/core/7_4_0/core/org/apache/lucene/store/NIOFSDirectory.html On Sun, Mar 31, 2019 at 3:04 PM Chellasamy G <chellasam...@zohocorp.com.invalid> wrote: > > Hi All, > > > > I am committing an index periodically using a scheduler. On a rare case I got > the below exception in the committing thread, > > > > Lucene Version : 7.4.0 > > > > java.nio.channels.ClosedByInterruptException > > at > java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:202) > > at sun.nio.ch.FileChannelImpl.size(FileChannelImpl.java:314) > > at > org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:182) > > at > org.apache.lucene.store.LockValidatingDirectoryWrapper.sync(LockValidatingDirectoryWrapper.java:67) > > at org.apache.lucene.index.SegmentInfos.write(SegmentInfos.java:466) > > at org.apache.lucene.index.SegmentInfos.prepareCommit(SegmentInfos.java:772) > > at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:4739) > > at > org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:3281) > > at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3449) > > at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3414) > > > > > > > > After this exception I am getting the below exception subsequently while > trying to commit the index, > > > > > > org.apache.lucene.store.AlreadyClosedException: FileLock invalidated by an > external force: > NativeFSLock(path=C:\luc-index\write.lock,impl=sun.nio.ch.FileLockImpl[0:9223372036854775807 > exclusive invalid],creationTime=2019-03-29T10:40:15.601535Z) > > at > org.apache.lucene.store.NativeFSLockFactory$NativeFSLock.ensureValid(NativeFSLockFactory.java:178) > > at > org.apache.lucene.store.LockValidatingDirectoryWrapper.syncMetaData(LockValidatingDirectoryWrapper.java:61) > > at org.apache.lucene.index.SegmentInfos.prepareCommit(SegmentInfos.java:771) > > at org.apache.lucene.index.IndexWriter.startCommit(IndexWriter.java:4739) > > at > org.apache.lucene.index.IndexWriter.prepareCommitInternal(IndexWriter.java:3281) > > at org.apache.lucene.index.IndexWriter.commitInternal(IndexWriter.java:3449) > > at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:3414) > > > > > > Has anybody faced this exception before and know the root cause of this issue? > > > > > > Thanks in Advance, > > Satyan --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org