Hi all, When indexing with multiple threads, and under heavy load, I get the following exception:
java.io.IOException: Access is denied at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:850) at org.apache.lucene.store.FSDirectory$1.obtain(FSDirectory.java:363) at org.apache.lucene.store.Lock.obtain(Lock.java:63) I am using the Compass framework from Open Symphony, however this simply sits on top of Lucene and the folks at Open Symphony have assured me that the access to Lucene indexes within their framework is appropriately synchronized. In either case, I would have thought Lucene should be managing its locks regardless of how the indexes are accessed (within the same JVM at least). There is a bug report on the Sun website for this issue: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6325169 This appears to be relevant, however it maybe Lucene is not synchronizing appropriately when obtaining a lock? The org.apache.lucene.store.FSDirectory implementation in Lucene 2.0.0appears to obtain a file lock thus: public boolean obtain() throws IOException { if (disableLocks) return true; if (!lockDir.exists()) { if (!lockDir.mkdirs()) { throw new IOException("Cannot create lock directory: " + lockDir); } } return lockFile.createNewFile(); } Should the line "lockFile.createNewFile();" be within some form of synchronizion block? Thanks.