nick-boss-tech opened a new pull request, #5192:
URL: https://github.com/apache/solr/pull/5192

   🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)*
   
   https://issues.apache.org/jira/browse/SOLR-18564
   
   ## Summary
   
   **A timeout in the client close pool can stop `CoreContainer.shutdown()` 
before the container handlers and root metrics context are closed.**
   
   On the base code, the close-pool wait is unguarded at 
[CoreContainer.java](https://github.com/nick-boss-tech/solr/blob/78923482727b8530d26ad08db734712ab2dacb12/solr/core/src/java/org/apache/solr/core/CoreContainer.java#L1310-L1316).
 When its budget expires, it throws and prevents the later [handler and 
metrics-context 
closes](https://github.com/nick-boss-tech/solr/blob/78923482727b8530d26ad08db734712ab2dacb12/solr/core/src/java/org/apache/solr/core/CoreContainer.java#L1363-L1369)
 from running.
   
   ## Changes
   
   **The close-pool timeout is logged and shutdown continues in its existing 
order.**
   
   
[CoreContainer.java](https://github.com/nick-boss-tech/solr/blob/dd65b21b41dc1d008c51031b71f61964ee2ca169/solr/core/src/java/org/apache/solr/core/CoreContainer.java#L1315-L1325)
 now catches the `RuntimeException` from that one wait. The following plugin 
closes, [container-handler close, root metrics-context close, and registry 
close](https://github.com/nick-boss-tech/solr/blob/dd65b21b41dc1d008c51031b71f61964ee2ca169/solr/core/src/java/org/apache/solr/core/CoreContainer.java#L1373-L1379)
 still run. `ExecutorUtil` is unchanged.
   
   ## Test
   
   **`CoreContainerShutdownTest` forces the real timeout path and checks both 
closes that were skipped.**
   
   The 
[test](https://github.com/nick-boss-tech/solr/blob/dd65b21b41dc1d008c51031b71f61964ee2ca169/solr/core/src/test/org/apache/solr/core/CoreContainerShutdownTest.java#L58-L88)
 loads a real container, adds a handler with an observable close, and blocks a 
shard-handler close until the pool wait throws. It then checks both later 
closes.
   
   ## Proof
   
   **The new test fails on the base code with the reported timeout and leak, 
and it passes with this change.**
   
   On the base code, the test failed with `RuntimeException: Timeout waiting 
for pool to shutdown. [poolName=closeThreadPool]`; class teardown also reported 
15 unreleased `SolrMetricsContext` objects. The code was verified on 2026-10-21 
at d7caa8cb784c2c3198599766bb52005241e4104b, before the final changelog-only 
commit. At that code head, `CoreContainerShutdownTest` passed 1 of 1, and 
`TestCoreContainer` passed with 25 tests, 0 failures, and 3 skipped. Formatting 
checks, Error Prone compilation, and the Solr core module check all passed.
   
   ## Limits
   
   **This change contains the effect of the timeout; it does not make a slow 
client close finish sooner.**
   
   - The regression test takes about two minutes by design. It uses the 
production timeout, which is hardcoded as two 60-second waits, and there is no 
faster deterministic trigger for the same failure.
   - Why a client close can outlive that budget under load is out of scope.
   - `ExecutorUtil` is deliberately unchanged because other callers may rely on 
its timeout exception. Only this shutdown call site catches and logs it.
   
   Changelog: 
[changelog/unreleased/SOLR-18564.yml](https://github.com/nick-boss-tech/solr/blob/dd65b21b41dc1d008c51031b71f61964ee2ca169/changelog/unreleased/SOLR-18564.yml)
   
   *AI-generated description. Nick Shanin directed the work and takes 
responsibility for this contribution.*
   


-- 
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