janhoy opened a new pull request, #4917: URL: https://github.com/apache/solr/pull/4917
https://issues.apache.org/jira/browse/SOLR-18442 ## Root cause The `SolrMetricsContext.observable{Long,Double}{Gauge,Counter}` overloads that take an `OtelUnit` never added the instrument to the context's `closeables`, so `SolrMetricsContext.close()` could not unregister them. `SolrIndexSearcher` registers its `index.commit_size` gauge with `OtelUnit.MEGABYTES`, so exactly one `CallbackRegistration` per searcher survived `close()`, pinning the searcher, its `DirectoryReader` and every segment's live-docs bitset in the OTel meter. This matches the one-registration-per-searcher growth in the JIRA heap histograms. `UpdateLog`, `SuggestComponent` and `ZkContainer` register metrics with a unit through the same path. ## Fix The unit-bearing overloads now register the closeable; the no-unit overloads delegate to them. No changes to callers. ## Test `SolrMetricsContextTest` registers all eight overload variants, closes the context and asserts no callback fires on the next collect. Fails without the fix (the four unit-bearing callbacks keep firing), passes with it, no GC dependence. Compared with #4902: this fixes the missing unregistration instead of weakening the reader reference, and also covers the other leaking callers. The `<metrics enabled="false"/>` question from the JIRA is left out of this PR. -- 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]
