Hi, I've written a unit test for a custom search component, which naturally extends the SolrTestCaseJ4. beforeClass() has initCore(), assertU(adoc()) and assertU(commit()) inside. The test creates a SolrQueryRequest via req() and runs h.query(request). In other words, nothing special. I see a rather strange SolrIndexSearcher initialization behavior: 1. 2 searchers are created one after another (OK). 2. When the second searcher finishes initialization, the first is closed (NOT OK?). 3. Afterwards, the second searcher is also closed (REALLY NOT OK). 4. The test query seems to run against the already closed searcher.
I noticed this behavior because I have some custom cache in place, which is populated during warmup. 2 instances of the cache are created and both are later closed. After closing, the cache is being used in actual query, and obviously it's already empty. This seems like a race condition. Both searchers are being closed here: if (!alreadyRegistered) { future = searcherExecutor.submit( new Callable() { public Object call() throws Exception { try { // registerSearcher will decrement onDeckSearchers and // do a notify, even if it fails. registerSearcher(newSearchHolder); } catch (Throwable e) { SolrException.log(log, e); } finally { // we are all done with the old searcher we used // for warming... if (currSearcherHolderF!=null) *currSearcherHolderF.decref();* } return null; } } ); } -- View this message in context: http://lucene.472066.n3.nabble.com/SolrTestCaseJ4-and-searcher-initialization-tp4028237.html Sent from the Solr - User mailing list archive at Nabble.com.