dsmiley commented on code in PR #1243:
URL: https://github.com/apache/solr/pull/1243#discussion_r1062115144


##########
solr/core/src/java/org/apache/solr/core/SolrCores.java:
##########
@@ -99,37 +85,34 @@ protected void close() {
     waitForLoadingCoresToFinish(30 * 1000);
     Collection<SolrCore> coreList = new ArrayList<>();
 
-    // Release transient core cache.
-    synchronized (modifyLock) {
-      if (transientSolrCoreCacheFactory != null) {
-        getTransientCacheHandler().close();
-      }
-    }
-
     // It might be possible for one of the cores to move from one list to 
another while we're
     // closing them. So loop through the lists until they're all empty. In 
particular, the core
     // could have moved from the transient list to the pendingCloses list.
-    do {
-      coreList.clear();
+    while (true) {
+
       synchronized (modifyLock) {
-        // make a copy of the cores then clear the map so the core isn't 
handed out to a request
-        // again
-        coreList.addAll(cores.values());
-        cores.clear();
-        if (transientSolrCoreCacheFactory != null) {
-          coreList.addAll(getTransientCacheHandler().prepareForShutdown());
+        // remove all loaded cores; add to our working list.
+        for (String name : getLoadedCoreNames()) {
+          final var core = remove(name);
+          if (core != null) {

Review Comment:
   The null check is actually needed, as I found 
TestCoreDiscovery.testTooManyTransientCores will fail.  It's vaguely explained 
in a comment here.  In more detail, transient core cache eviction can happen on 
any core manipulation, including the removal call.  So we might get core list 
A, B, C.  Then we remove A, triggering a cache maintenance resulting in B 
getting removed/evicted.  Then we try to remove B and it's already removed (and 
was put in pendingCloses).



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

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


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

Reply via email to