lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Monsur Hossain" <>
Subject RE: IndexSearcher hanging on to old index files in Windows
Date Fri, 29 Apr 2005 18:29:12 GMT
> Just tried this on my linux laptop - with IndexSearcher uncommented, I
> still get a single .cfs file.  It's one of those problems 
> where Windows
> doesn't let you erase the file.  I'd start this SortTest in the
> debugger and step through it until you find a spot where you see that
> some index file deletion fails.

Using the debugger and Process Explorer, I've been spending the morning
learning about file management in Lucene, and its fascinating stuff!

Sure enough, the IndexSearcher opens a handle to the first .cfs file.  After
the incremental index is updated and optimized, the IndexWriter tries to
delete the old .cfs file, but fails with the error:

"The process cannot access the file because it is being used by another

It then sticks the filename in Lucene's "deletable" file to be deleted at
some later time.  As a sanity check I used Process Explorer to delete the
file handle before running the incremental index, and it worked fine.

Since this is happening in both .NET and Java, I'm assuming its Windows
specific.  I don't know much about Windows low-level file management, but
I'm going to keep digging into this issue further.  Does anyone have any
expertise in this area, or know why this behavior is different in Windows
vs. Linux?

In the meantime, I think I can just ignore this issue, since the old .cfs
name is stored in the "deletable" file.  I'm guessing that at some later
point, once the IndexSearcher has been garbage collected, Lucene will load
that filename from "deletable", and then delete it.  I just worry that my
index will become too cluttered in the meantime (especially after an


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

View raw message