I came across this issue on a production site. It was using xwiki-plugin-lucene-1.12.
org.apache.lucene.search.IndexSearcher
from lucene-core-2.9.1.jar has this comment for the close() method
/**
- Note that the underlying IndexReader is not closed, if
- IndexSearcher was constructed with IndexSearcher(IndexReader r).
- If the IndexReader was supplied implicitly by specifying a directory, then
- the IndexReader gets closed.
*/
The issue is that the underlying reader is not closed, and on Solaris at least, dtrace can be used to see that several cfs files are opened but not closed before unlinking. That is the cause of the file descriptor leak.
A simple solution is to change the way
com.xpn.xwiki.plugin.lucene.LucenePlugin
public Searcher[] createSearchers(String indexDirs, XWikiContext context)
method adds to searchersList i.e. collapse
IndexReader reader = IndexReader.open(dirs[i], true);
searchersList.add(new IndexSearcher(reader));
to
searchersList.add(new IndexSearcher(dirs[i], true));
That way the IndexReaders are closed and no more fd leaks occur.
I came across this issue on a production site. It was using xwiki-plugin-lucene-1.12.
org.apache.lucene.search.IndexSearcher
from lucene-core-2.9.1.jar has this comment for the close() method
/**
*/
The issue is that the underlying reader is not closed, and on Solaris at least, dtrace can be used to see that several cfs files are opened but not closed before unlinking. That is the cause of the file descriptor leak.
A simple solution is to change the way
com.xpn.xwiki.plugin.lucene.LucenePlugin
public Searcher[] createSearchers(String indexDirs, XWikiContext context)
method adds to searchersList i.e. collapse
IndexReader reader = IndexReader.open(dirs[i], true);
searchersList.add(new IndexSearcher(reader));
to
searchersList.add(new IndexSearcher(dirs[i], true));
That way the IndexReaders are closed and no more fd leaks occur.
- Note that the underlying IndexReader is not closed, if
- IndexSearcher was constructed with IndexSearcher(IndexReader r).
- If the IndexReader was supplied implicitly by specifying a directory, then
- the IndexReader gets closed.
*/
The issue is that the underlying reader is not closed, and on Solaris at least, dtrace can be used to see that several cfs files are opened but not closed before unlinking. That is the cause of the file descriptor leak. A simple solution is to change the way com.xpn.xwiki.plugin.lucene.LucenePlugin public Searcher[] createSearchers(String indexDirs, XWikiContext context) method adds to searchersList i.e. collapse IndexReader reader = IndexReader.open(dirs[i], true); searchersList.add(new IndexSearcher(reader)); to searchersList.add(new IndexSearcher(dirs[i], true)); That way the IndexReaders are closed and no more fd leaks occur.