You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "nick-boss-tech (via GitHub)" <gi...@apache.org> on 2026/10/22 06:45:27 UTC

[PR] SOLR-18564: CoreContainer.shutdown: run the remaining closes when the client close pool times out [solr]

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: issues-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18564: CoreContainer.shutdown: run the remaining closes when the client close pool times out [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #5192:
URL: https://github.com/apache/solr/pull/5192#issuecomment-6338635198

   I wish had a I more confidence in my understanding of how threads etc work in Java...   I may have to just suck it up and spend a bit more time learning the theory behind it.  This PR seems good, I just need to figure out how to build confidence that I udnerstand that it IS good!


-- 
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-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18564: CoreContainer.shutdown: run the remaining closes when the client close pool times out [solr]

Posted by "sigram (via GitHub)" <gi...@apache.org>.
sigram commented on PR #5192:
URL: https://github.com/apache/solr/pull/5192#issuecomment-6439747314

   Normally I would hesitate to broadly catch a RuntimeException - but in reality this change affects only tests because at this point the CoreContainer is not usable for normal purpose anyway. Maybe we can narrow down the Exception or message?


-- 
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-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18564: CoreContainer.shutdown: run the remaining closes when the client close pool times out [solr]

Posted by "nick-boss-tech (via GitHub)" <gi...@apache.org>.
nick-boss-tech commented on PR #5192:
URL: https://github.com/apache/solr/pull/5192#issuecomment-6475505981

   This PR saw the shutdown issue on a CI run today: https://github.com/apache/solr/pull/5016


-- 
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-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18564: CoreContainer.shutdown: run the remaining closes when the client close pool times out [solr]

Posted by "nick-boss-tech (via GitHub)" <gi...@apache.org>.
nick-boss-tech commented on PR #5192:
URL: https://github.com/apache/solr/pull/5192#issuecomment-6450986593

   🤖 *AI text below* 🤖 *(reviewed by Nick Shanin)*
   
   @sigram, agreed. [bd42a1d58b9](https://github.com/apache/solr/commit/bd42a1d58b9fba4656a200536a007d9d79dc45b2) adds `ExecutorUtil.ExecutorTerminationTimeoutException`, a `RuntimeException` subtype, and narrows the `CoreContainer.shutdown()` catch to that type. Other runtime exceptions propagate. The timeout message and pool details are unchanged. [Full follow-up diff, including the tidy repair](https://github.com/apache/solr/compare/dd65b21b41dc1d008c51031b71f61964ee2ca169...6ca1cba8061b3c6298040634972afc4361f55add).
   
   At tested head `6ca1cba8061b3c6298040634972afc4361f55add`, `ExecutorUtilTest` (6 tests) and `CoreContainerShutdownTest` (1 test) pass on both seeds `18564ABC0001` and `18564ABC0002`. `TestCoreContainer` has 22 passes and 3 expected Windows-only skips per seed. Tidy, Error Prone compilation, and root `check -x test` pass, with `NODE_ENV` unset. Replacing only the typed timeout throw with plain `RuntimeException` makes the strengthened assertion fail with the expected type mismatch; the same test passes at the tested head.
   


-- 
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-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18564: CoreContainer.shutdown: run the remaining closes when the client close pool times out [solr]

Posted by "sigram (via GitHub) via issues" <is...@solr.apache.org>.
sigram merged PR #5192:
URL: https://github.com/apache/solr/pull/5192


-- 
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-unsubscribe@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org