Hi all, after some more tests with Sylvain on that
"java.io.FileNotFoundException" we could reproduce the problem on both 2.0.3
and trunk when stressing GeoNetwork (on linux, tomcat or jetty at least).
Problem occurs when too many search are made by lucene (you could try to use
apachebench "ab" to stress the app). Lucene opens index files but not close
thoses files in some cases. When the number of files opened by the java process
reach the system limit (ulimit -a), IOException occurs.
As said by Renaud, on option could be to increase the ulimit (see Lucene FAQ
also)
http://wiki.apache.org/lucene-java/LuceneFAQ#head-48921635adf2c968f7936dc07d51dfb40d638b82Another (and better) option is to close the IndexSearcher/Reader in
LuceneSearcher once search ended.
A comment on the close method in LuceneSearcher said "RGFIX: check this" and
close only the reader. It looks like it's better to close both searcher and
reader once the search is done. Then the session use only the hits element.
Any comments on that?
Applying the patch attached will solve the problem. If that sounds good to
everyone, it could be applied for 2.3
as not so many users seem to face the problem for the time being ?
Ciao. Francois
PS: Thanks a lot to Sylvain for his help on tracking/solving that bug ...
[GeoNetwork_tooManyOpenFiles.patch]
Index: org/fao/geonet/kernel/search/LuceneSearcher.java
===================================================================
--- org/fao/geonet/kernel/search/LuceneSearcher.java (revision 1210)
+++ org/fao/geonet/kernel/search/LuceneSearcher.java (working copy)
@@ -95,6 +95,7 @@
public void search(ServiceContext srvContext, Element request, ServiceConfig config)
throws Exception
{
+
computeQuery(srvContext, request, config);
performQuery(request);
initSearchRange(srvContext);
@@ -179,11 +180,12 @@
public void close()
{
- try
- {
+ try {
+ _searcher.close();
_reader.close();
- }
- catch (IOException e) { e.printStackTrace(); } // DEBUG
+ } catch (IOException e) {
+ e.printStackTrace();
+ } // DEBUG
}
//--------------------------------------------------------------------------------
@@ -267,11 +269,18 @@
_reader = IndexReader.open(_sm.getLuceneDir());
_searcher = new IndexSearcher(_reader);
- _hits = _searcher.search(_query, sort);
+
+ try {
+ _hits = _searcher.search(_query, sort);
- Log.debug(Geonet.SEARCH_ENGINE, "Hits found : "+ _hits.length());
+ Log.debug(Geonet.SEARCH_ENGINE, "Hits found : "+ _hits.length());
- makeSummary();
+ makeSummary();
+
+ } finally {
+ close ();
+ }
+
setValid(true);
}
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace_______________________________________________
GeoNetwork-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geonetwork-develGeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork