lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <>
Subject Re: Lucene appears to use memory maps after unmapping them
Date Wed, 01 Feb 2012 02:14:13 GMT
On Tue, Jan 31, 2012 at 8:32 PM, Trejkaz <> wrote:
> On Wed, Feb 1, 2012 at 11:30 AM, Robert Muir <> wrote:
>> the problem is caused by searching indexreaders after you closed them.
>> in general we can try to add more and more safety, but at the end of the day,
>> if you close an indexreader while a search is running, you will have problems.
>> So be careful to only close indexreaders that are no longer in use!
>> For multithreaded code you might want to investigate IndexReader's
>> reference counting mechanism or SearcherManager to help you track
>> this.
> So rather than flagging closed = true when close() is called and
> hitting someone who tries to read data, essentially try and do the
> reverse- if a search is still running and close() is called, throw an
> exception to them?

No, I don't think you should use close at all, because your problem is
you are calling close() when its unsafe to do so (you still have other
threads that try to search the reader after you closed it).

Instead of trying to fix the bugs in your code, I suggested using
SearcherManager, which uses IndexReaders reference counting API (or
you can use that directly alternatively).


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

View raw message