janhoy commented on code in PR #1905:
URL: https://github.com/apache/solr/pull/1905#discussion_r1319799318


##########
solr/core/src/java/org/apache/solr/util/circuitbreaker/MemoryCircuitBreaker.java:
##########
@@ -100,17 +123,11 @@ private long getCurrentMemoryThreshold() {
     return heapMemoryThreshold;
   }
 
-  /**
-   * Calculate the live memory usage for the system. This method has package 
visibility to allow
-   * using for testing.
-   *
-   * @return Memory usage in bytes.
-   */
-  protected long calculateLiveMemoryUsage() {
-    // NOTE: MemoryUsageGaugeSet provides memory usage statistics but we do 
not use them
-    // here since it will require extra allocations and incur cost, hence it 
is cheaper to use
-    // MemoryMXBean directly. Ideally, this call should not add noticeable
-    // latency to a query -- but if it does, please signify on SOLR-14588
-    return MEMORY_MX_BEAN.getHeapMemoryUsage().getUsed();
+  @Override
+  public void close() throws IOException {
+    if (averagingMetricProvider != null) {
+      averagingMetricProvider.close();
+      averagingMetricProvider = null;

Review Comment:
   In case you register multiple Mem CBs, the first instance will setup the 
executor and the first one closed will close the common executor. Ideally the 
last instance closed should close the executor. Imagine two cores, both setting 
up such a CB, then you delete one of the cores, which will trigger close(). The 
other core will now have a stale value since the background thread updating it 
is no longer running.
   
   Guess this is the downside of a shared object. Need to introduce some 
ref-counting or something?



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