lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Move from RAMDirectory to FSDirectory causing problem sometimes
Date Tue, 08 Jul 2008 15:39:17 GMT

It works because Lucene doesn't currently check for it, and, because  
closing an FSDirectory does not actually make it unusable.  In fact it  
also doesn't catch a double-close call.

But it may cause subtle problems, because FSDirectory has this  
invariant: only a single instance of FSDirectory exists per canonical  
directory in the filesystem.  This allows code to synchronized on that  
instance and sure no other code in the same JVM is also working in  
that canonical directory.

When you close an FSDirectory but keep using it you can get yourself  
to a point where this invariant is broken.  That said, besides  
IndexModifier (which is now deprecated), I can't find anything that  
would actually break when this invariant is broken.

Still I think we should put protection in to catch double-closing and  
prevent using a closed directory.  I'll open an issue.

Mike

Paul Taylor wrote:

> Michael McCandless wrote:
>>
>> Hmmm, you should not close the directory if you are then going to  
>> use it to instantiate a searcher.
> how come it works ?
>>
>> Your code below never closes the searcher?  I think that is most  
>> likely the source of your file descriptor leaks.
> Ok fixed
>
> paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


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


Mime
View raw message