lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <>
Subject Re: AlreadyClosedException in JUnit tests?
Date Thu, 29 Nov 2007 01:05:06 GMT
Yeah, SolrQueryRequest classes weren't really meant for re-use.
In general, we shouldn't re-use them for tests since they aren't
reused for normal requests.
nulling the searcher ref on a close may be a nice safety precaution though.


On Nov 28, 2007 6:13 PM, Chris Hostetter <> wrote:
> Hmmmm... the problem doesn't seem to be related to sorting at all, it
> looks like it has to do with the fact that most of the tests are reusing
> the same LocalSolrQueryRequest object over and over (just changing the
> params)  assertQ calls close() on the request object, which decrements
> some refrence counting on the SolrIndexSearcher (which gets closed when
> there are no more refrences)
> I'm guessing SolrCore keeps a refrence so normally a SolrIndexSearcher is
> only closed once the core and all requests are done with it -- but in the
> case of reusing LocalSolrQueryRequests, decref is probably getting called
> more often then it's incref.
> i can't believe we've never noticed this before.
> not sure what the best/easiest solution is ... change all hte tests to
> stop reusing the same Request object?  change LocalSolrQueryRequests so
> the TestHarness can re-init it for each query?
> actaully ... the root of the disconnect seems to be that while
> SolrQueryRequestBase.close() does a decref, nothing in
> SolrQueryRequestBase does an incref because it relies on
> SolrCore.getSearcher doing the incref for it when returning the
> RefCounted<SolrIndexSearcher>.  So what if SolrQueryRequestBase.close()
> nulled out searcherHolder after decrefing it ... then it would be safe to
> reuse a SolrQueryRequestBase  right?
> -Hoss

View raw message