javanna opened a new pull request, #12588:
URL: https://github.com/apache/lucene/pull/12588

   Until now, LuceneTestCase#newSearcher randomly associates the returned 
IndexSearcher instance with an executor that is ad-hoc created, which gets shut 
down when the index reader is closed.
   
   This has made us catch a couple of cases where we were not properly closing 
readers in tests. Most recently, we have been seeing test failures (OOM - 
unable to create thread) due to too many executor instances created as part of 
the same test. This is to be attributed to creating too many searcher instance, 
each one getting its separate executor, which all get shutdown at the end of 
the entire suite. The main offender for this is QueryUtils which creates a new 
searcher for each leaf reader, and the top-level reader gets closed in the 
AfterClass, hence all the executors will stay around for the entire duration of 
the test suite that relies on QueryUtils.
   
   This commit eagerly creates an executor in an additional before class method 
for LuceneTestCase, and associates that with each searcher that is supposed to 
get a non null executor.
   
   Note that the executor is shutdown in the after class to ensure that no 
threads leak in tests.
   
   This has the additional advantage that it removes the need to close the 
executor as part of an index reader close listener, which also requires the 
reader to have an associated reader cache helper.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to