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

   ### Description
   
   Fixes #14971.
   
   `ConcurrentMergeScheduler` creates a `CachedExecutor` (wrapping a 
`ThreadPoolExecutor`) in `mergeScheduler.initialize()`, which is called during 
`IndexWriter` construction. 
   
   When the constructor fails after this point, the catch block only closed the 
`writeLock` without closing the `mergeScheduler`, leaving the 
`ThreadPoolExecutor` alive and causing a thread pool leak detectable by 
LuceneTestCase's thread leak checker. 
   
   The fix adds `config.getMergeScheduler()` to the existing 
`IOUtils.closeWhileSuppressingExceptions` call in the catch block.
   
   `config.getMergeScheduler()` is used  instead of the `mergeScheduler` field 
directly because it is declared `final` and may not yet be assigned when the 
catch block is reached.
   
   This PR includes a regression test that verifies the `MergeScheduler` is 
properly closed when `IndexWriter` initialization fails.
   
   Closes #14971


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to