serhiy-bzhezytskyy commented on code in PR #4764:
URL: https://github.com/apache/solr/pull/4764#discussion_r3819165257
##########
solr/core/src/java/org/apache/solr/core/CoreContainer.java:
##########
@@ -1382,13 +1382,12 @@ public void shutdown() {
}
public void cancelCoreRecoveries() {
-
- List<SolrCore> cores = solrCores.getCores();
-
// we must cancel without holding the cores sync
// make sure we wait for any recoveries to stop
- for (SolrCore core : cores) {
- try {
+ for (String coreName : solrCores.getLoadedCoreNames()) {
+ // getCoreFromAnyList, not getCore: never loads, safe during shutdown
+ try (SolrCore core = solrCores.getCoreFromAnyList(coreName, true)) {
Review Comment:
`getCoreFromAnyList(name, true)` does inc-ref -- the second param is
literally named `incRefCount`, and its body calls `core.open()`, whose own
javadoc says "expert: increments the core reference count". So
`try-with-resources`'s `close()` here releases exactly that reference, not an
un-reserved one. Same pattern is already used elsewhere in this file
(`SolrCore.java:3447`/`3482`).
AI-assisted (Claude Sonnet 5)
--
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]