You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Andrew Zhang <zh...@gmail.com> on 2008/11/21 05:42:17 UTC

FileNotFoundException during IndexWriter#commit in lucene-2.4.0

Hi,

I met FileNotFoundException when using lucene 2.4.0. Please see the stack
trace[1] below. I checked the code of lucene-2.4, found the following code
throws FileNotFoundException:

file = new RandomAccessFile(path, "rw");

I checked system log, and found a warning before the exception: unable to
unlink '/sdcard/.servo/.index/_3.fdt' (errno=2)

Any hint what the problem is? Possible race condition during commit?

My index process was killed by system somtimes, but I assume it's OK for
lucene-2.4.

Thanks a lot in advance!

[1]
java.io.FileNotFoundException: /sdcard/.servo/.index/_3.fdt
    at
org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:227)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:109)
    at
org.apache.lucene.store.FSDirectory$FSIndexOutput.<init>(FSDirectory.java:639)
    at
org.apache.lucene.store.FSDirectory.createOutput(FSDirectory.java:442)
    at org.apache.lucene.index.FieldsWriter.<init>(FieldsWriter.java:62)
    at
org.apache.lucene.index.StoredFieldsWriter.initFieldsWriter(StoredFieldsWriter.java:67)
    at
org.apache.lucene.index.StoredFieldsWriter.finishDocument(StoredFieldsWriter.java:141)
    at
org.apache.lucene.index.StoredFieldsWriter$PerDoc.finish(StoredFieldsWriter.java:187)
    at
org.apache.lucene.index.DocumentsWriter$WaitQueue.writeDocument(DocumentsWriter.java:1408)
    at
org.apache.lucene.index.DocumentsWriter$WaitQueue.add(DocumentsWriter.java:1427)
    at
org.apache.lucene.index.DocumentsWriter.finishDocument(DocumentsWriter.java:1062)
    at
org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:768)
    at
org.apache.lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:743)
    at
org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1902)
    at
org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1880)


-- 
Best regards,
Andrew Zhang

db4o - database for Android: www.db4o.com
http://zhanghuangzhu.blogspot.com/

Re: FileNotFoundException during IndexWriter#commit in lucene-2.4.0

Posted by Michael McCandless <lu...@mikemccandless.com>.
Phew :)

Mike

Andrew Zhang wrote:

> Thanks a lot Mike!
>
> Your answer is really helpful. It was indeed caused by my sdcard,  
> which turned into read-only mode under some situation.
>
> Thanks for your time!
>
> On Fri, Nov 21, 2008 at 5:55 PM, Michael McCandless <lucene@mikemccandless.com 
> > wrote:
>
> That exception actually isn't during commit -- it's during  
> addDocument.  Are you saying there was a separate thread calling  
> commit at the same time?
>
> The error is very odd: Lucene is trying to create the file _3.fdt  
> (open for "rw" as you noted), yet hit a FileNotFoundException.  Can  
> you check that the index directory is actually writable by your  
> process, and reply back with the "ls -l" output?
>
> The "unable to unlink" error is probably just Lucene trying to clean  
> up on handling the exception.
>
> It's OK for the JVM to be kill -9'd in 2.4 as well as 2.3 (it won't  
> corrupt your index).  It's OS/hardware crashes, power loss, etc,  
> where 2.3 could corrupt the index but 2.4 shouldn't.
>
> Mike
>
>
> Andrew Zhang wrote:
>
> Hi,
>
> I met FileNotFoundException when using lucene 2.4.0. Please see the  
> stack trace[1] below. I checked the code of lucene-2.4, found the  
> following code throws FileNotFoundException:
>
> file = new RandomAccessFile(path, "rw");
>
> I checked system log, and found a warning before the exception:  
> unable to unlink '/sdcard/.servo/.index/_3.fdt' (errno=2)
>
> Any hint what the problem is? Possible race condition during commit?
>
> My index process was killed by system somtimes, but I assume it's OK  
> for lucene-2.4.
>
> Thanks a lot in advance!
>
> [1]
> java.io.FileNotFoundException: /sdcard/.servo/.index/_3.fdt
>    at  
> org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java: 
> 227)
>    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:109)
>    at org.apache.lucene.store.FSDirectory 
> $FSIndexOutput.<init>(FSDirectory.java:639)
>    at  
> org.apache.lucene.store.FSDirectory.createOutput(FSDirectory.java:442)
>    at org.apache.lucene.index.FieldsWriter.<init>(FieldsWriter.java: 
> 62)
>    at  
> org 
> .apache 
> .lucene 
> .index.StoredFieldsWriter.initFieldsWriter(StoredFieldsWriter.java:67)
>    at  
> org 
> .apache 
> .lucene 
> .index.StoredFieldsWriter.finishDocument(StoredFieldsWriter.java:141)
>    at org.apache.lucene.index.StoredFieldsWriter 
> $PerDoc.finish(StoredFieldsWriter.java:187)
>    at org.apache.lucene.index.DocumentsWriter 
> $WaitQueue.writeDocument(DocumentsWriter.java:1408)
>    at org.apache.lucene.index.DocumentsWriter 
> $WaitQueue.add(DocumentsWriter.java:1427)
>    at  
> org 
> .apache 
> .lucene.index.DocumentsWriter.finishDocument(DocumentsWriter.java: 
> 1062)
>    at  
> org 
> .apache 
> .lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:768)
>    at  
> org 
> .apache 
> .lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:743)
>    at  
> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1902)
>    at  
> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1880)
>
>
> -- 
> Best regards,
> Andrew Zhang
>
> db4o - database for Android: www.db4o.com
> http://zhanghuangzhu.blogspot.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
>
>
> -- 
> Best regards,
> Andrew Zhang
>
> db4o - database for Android: www.db4o.com
> http://zhanghuangzhu.blogspot.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Re: FileNotFoundException during IndexWriter#commit in lucene-2.4.0

Posted by Andrew Zhang <zh...@gmail.com>.
Thanks a lot Mike!

Your answer is really helpful. It was indeed caused by my sdcard, which
turned into read-only mode under some situation.

Thanks for your time!

On Fri, Nov 21, 2008 at 5:55 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

>
> That exception actually isn't during commit -- it's during addDocument.
>  Are you saying there was a separate thread calling commit at the same time?
>
> The error is very odd: Lucene is trying to create the file _3.fdt (open for
> "rw" as you noted), yet hit a FileNotFoundException.  Can you check that the
> index directory is actually writable by your process, and reply back with
> the "ls -l" output?
>
> The "unable to unlink" error is probably just Lucene trying to clean up on
> handling the exception.
>
> It's OK for the JVM to be kill -9'd in 2.4 as well as 2.3 (it won't corrupt
> your index).  It's OS/hardware crashes, power loss, etc, where 2.3 could
> corrupt the index but 2.4 shouldn't.
>
> Mike
>
>
> Andrew Zhang wrote:
>
>  Hi,
>>
>> I met FileNotFoundException when using lucene 2.4.0. Please see the stack
>> trace[1] below. I checked the code of lucene-2.4, found the following code
>> throws FileNotFoundException:
>>
>> file = new RandomAccessFile(path, "rw");
>>
>> I checked system log, and found a warning before the exception: unable to
>> unlink '/sdcard/.servo/.index/_3.fdt' (errno=2)
>>
>> Any hint what the problem is? Possible race condition during commit?
>>
>> My index process was killed by system somtimes, but I assume it's OK for
>> lucene-2.4.
>>
>> Thanks a lot in advance!
>>
>> [1]
>> java.io.FileNotFoundException: /sdcard/.servo/.index/_3.fdt
>>    at
>> org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:227)
>>    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:109)
>>    at
>> org.apache.lucene.store.FSDirectory$FSIndexOutput.<init>(FSDirectory.java:639)
>>    at
>> org.apache.lucene.store.FSDirectory.createOutput(FSDirectory.java:442)
>>    at org.apache.lucene.index.FieldsWriter.<init>(FieldsWriter.java:62)
>>    at
>> org.apache.lucene.index.StoredFieldsWriter.initFieldsWriter(StoredFieldsWriter.java:67)
>>    at
>> org.apache.lucene.index.StoredFieldsWriter.finishDocument(StoredFieldsWriter.java:141)
>>    at
>> org.apache.lucene.index.StoredFieldsWriter$PerDoc.finish(StoredFieldsWriter.java:187)
>>    at
>> org.apache.lucene.index.DocumentsWriter$WaitQueue.writeDocument(DocumentsWriter.java:1408)
>>    at
>> org.apache.lucene.index.DocumentsWriter$WaitQueue.add(DocumentsWriter.java:1427)
>>    at
>> org.apache.lucene.index.DocumentsWriter.finishDocument(DocumentsWriter.java:1062)
>>    at
>> org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:768)
>>    at
>> org.apache.lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:743)
>>    at
>> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1902)
>>    at
>> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1880)
>>
>>
>> --
>> Best regards,
>> Andrew Zhang
>>
>> db4o - database for Android: www.db4o.com
>> http://zhanghuangzhu.blogspot.com/
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>


-- 
Best regards,
Andrew Zhang

db4o - database for Android: www.db4o.com
http://zhanghuangzhu.blogspot.com/

Re: FileNotFoundException during IndexWriter#commit in lucene-2.4.0

Posted by Michael McCandless <lu...@mikemccandless.com>.
That exception actually isn't during commit -- it's during  
addDocument.  Are you saying there was a separate thread calling  
commit at the same time?

The error is very odd: Lucene is trying to create the file _3.fdt  
(open for "rw" as you noted), yet hit a FileNotFoundException.  Can  
you check that the index directory is actually writable by your  
process, and reply back with the "ls -l" output?

The "unable to unlink" error is probably just Lucene trying to clean  
up on handling the exception.

It's OK for the JVM to be kill -9'd in 2.4 as well as 2.3 (it won't  
corrupt your index).  It's OS/hardware crashes, power loss, etc, where  
2.3 could corrupt the index but 2.4 shouldn't.

Mike

Andrew Zhang wrote:

> Hi,
>
> I met FileNotFoundException when using lucene 2.4.0. Please see the  
> stack trace[1] below. I checked the code of lucene-2.4, found the  
> following code throws FileNotFoundException:
>
> file = new RandomAccessFile(path, "rw");
>
> I checked system log, and found a warning before the exception:  
> unable to unlink '/sdcard/.servo/.index/_3.fdt' (errno=2)
>
> Any hint what the problem is? Possible race condition during commit?
>
> My index process was killed by system somtimes, but I assume it's OK  
> for lucene-2.4.
>
> Thanks a lot in advance!
>
> [1]
> java.io.FileNotFoundException: /sdcard/.servo/.index/_3.fdt
>     at  
> org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java: 
> 227)
>     at java.io.RandomAccessFile.<init>(RandomAccessFile.java:109)
>     at org.apache.lucene.store.FSDirectory 
> $FSIndexOutput.<init>(FSDirectory.java:639)
>     at  
> org.apache.lucene.store.FSDirectory.createOutput(FSDirectory.java:442)
>     at org.apache.lucene.index.FieldsWriter.<init>(FieldsWriter.java: 
> 62)
>     at  
> org 
> .apache 
> .lucene 
> .index.StoredFieldsWriter.initFieldsWriter(StoredFieldsWriter.java:67)
>     at  
> org 
> .apache 
> .lucene 
> .index.StoredFieldsWriter.finishDocument(StoredFieldsWriter.java:141)
>     at org.apache.lucene.index.StoredFieldsWriter 
> $PerDoc.finish(StoredFieldsWriter.java:187)
>     at org.apache.lucene.index.DocumentsWriter 
> $WaitQueue.writeDocument(DocumentsWriter.java:1408)
>     at org.apache.lucene.index.DocumentsWriter 
> $WaitQueue.add(DocumentsWriter.java:1427)
>     at  
> org 
> .apache 
> .lucene.index.DocumentsWriter.finishDocument(DocumentsWriter.java: 
> 1062)
>     at  
> org 
> .apache 
> .lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:768)
>     at  
> org 
> .apache 
> .lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:743)
>     at  
> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1902)
>     at  
> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1880)
>
>
> -- 
> Best regards,
> Andrew Zhang
>
> db4o - database for Android: www.db4o.com
> http://zhanghuangzhu.blogspot.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org