lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <>
Subject Re: Too many open files
Date Fri, 03 Sep 2010 14:22:23 GMT

You are probably not closing all your searchers properly.  What
version of lucene are you using?  I think that something changed in
recent releases and old searchers that used to get garbage collected
had their files automatically closed, and that no longer happens.
Something along those lines anyway.  Maybe you need to store a
reference to the underlying Directory and call close() on that.

I expect that if you search and dig around in the list archives you'll
find a better explanation - or wait for someone else to explain it
properly.  But I'm pretty sure that the underlying message is correct
- make sure you close everything related to your old searchers.

As an aside, the problem might be less if you skipped the optimize
step.  In general you don't need to call optimize.


On Fri, Sep 3, 2010 at 2:47 PM, Gennadiy Kozlenko <> wrote:
> To make a search by lucene we use Web application that is working in the
> servlet-container tomcat.
> Periodically we update the search index by adding and removing some of the
> documents. To update the index we make the following actions:
> 1. Open the index
> 2. Add/delete documents
> 3. In case it is needed we optimize the index
> 4. Close the index
> After the updates of search index were done we report the Web application
> that there are changes in the index. Web application does the following:
> 1. Close old index search object (before closing the application waits until
> all steams finish up the work with search index):
> searcher.close()
> 2. Create new index search object - searcher:
> File file = new File(pathToIndex);
> IndexSearcher searcher = new IndexSearcher(, true);
> After a while, the Web application stops operating because of the error "Too
> many open files". If you look at a list of files that were opened by tomcat
> process (using the command "ls -la /proc/$PID/fd"),  you can see that there
> are a lot of deleted ".cfs" files.
> There are no errors in the tomcat logs.
> Can you help us to figure out why this situation is occurred and how to
> solve it up?
> Thanks in advance.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message