lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] [Commented] (LUCENE-7582) NIOFSDirectory sometime doesn't work on windows
Date Tue, 06 Dec 2016 11:59:00 GMT


Michael McCandless commented on LUCENE-7582:

Note that the exception you are hitting is a different issue than the JDK bug.  The JDK bug
is about poor performance, whereas your exception prevent IndexWriter.commit from working

I suspect your exception is because of how Lucene re-opens a file (for write) when it needs
to commit it.  Are you using near-real-time readers?  One possible workaround might be to
not use near-real-time readers, i.e. open your reader from the Directory, and then refresh
it after committing from IndexWriter.

Do you have any external processes that open Lucene's index files, e.g. virus checkers?

We have investiaged {{AsynchronousFileChannel}} in the past, see e.g.
but it did not pan out.

If your indices are smallish you might get away with using {{MMapDirectory}} even on 32 bit

> NIOFSDirectory sometime doesn't work on windows
> -----------------------------------------------
>                 Key: LUCENE-7582
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/store
>    Affects Versions: 5.3.1
>         Environment: Windows 10, 32 bits JVM
>            Reporter: Kevin Senechal
> Hi!
> I've an error using lucene on windows. I already post a question on modeshape forum (
and it looks that NIOFSDirectory is not working well on windows as described in the java documentation
of this class.
> {quote}NOTE: NIOFSDirectory is not recommended on Windows because of a bug in how
is implemented in Sun's JRE. Inside of the implementation the position is apparently synchronized.
See here for details.{quote}
> After reading the linked java issue (,
it seems that there is a workaround to solve it, use an AsynchronousFileChannel.
> Is it a choice that has been made to not use AsynchronousFileChannel or will it be a
good fix?
> You'll find the complete stacktrace below:
> {code:java}
> Caused by: org.modeshape.jcr.index.lucene.LuceneIndexException: Cannot commit index writer
>   at org.modeshape.jcr.index.lucene.LuceneIndex.commit( ~[dsdk-launcher.jar:na]
>   at org.modeshape.jcr.spi.index.provider.IndexChangeAdapter.completeWorkspaceChanges(
>   at org.modeshape.jcr.cache.change.ChangeSetAdapter.notify(
>   at org.modeshape.jcr.spi.index.provider.IndexProvider$AtomicIndex.notify(
>   at org.modeshape.jcr.bus.RepositoryChangeBus.notify( ~[dsdk-launcher.jar:na]
>   at org.modeshape.jcr.cache.document.WorkspaceCache.changed(
>   at org.modeshape.jcr.txn.SynchronizedTransactions.updateCache(
>   at
>   at ~[dsdk-launcher.jar:na]
>   ... 19 common frames omitted  
> Caused by: java.nio.file.FileSystemException: C:\Users\Christopher\Infiltrea3CLOUDTEST8\\indexes\default\nodesByPath\_dc_Lucene50_0.doc:
The process cannot access the file because it is being used by another process.  
>   at sun.nio.fs.WindowsException.translateToIOException( ~[na:1.8.0_92]
>   at sun.nio.fs.WindowsException.rethrowAsIOException( ~[na:1.8.0_92]
>   at sun.nio.fs.WindowsException.rethrowAsIOException( ~[na:1.8.0_92]
>   at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(
>   at ~[na:1.8.0_92]  
>   at ~[na:1.8.0_92]  
>   at org.apache.lucene.util.IOUtils.fsync( ~[dsdk-launcher.jar:na] 

>   at ~[dsdk-launcher.jar:na]
>   at ~[dsdk-launcher.jar:na]
>   at
>   at org.apache.lucene.index.IndexWriter.startCommit( ~[dsdk-launcher.jar:na]
>   at org.apache.lucene.index.IndexWriter.prepareCommitInternal(
>   at org.apache.lucene.index.IndexWriter.commitInternal( ~[dsdk-launcher.jar:na]
>   at org.apache.lucene.index.IndexWriter.commit( ~[dsdk-launcher.jar:na]
>   at org.modeshape.jcr.index.lucene.LuceneIndex.commit( ~[dsdk-launcher.jar:na]

> {code}
> Thank you in advance for your help

This message was sent by Atlassian JIRA

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

View raw message