[ 
https://issues.apache.org/jira/browse/SOLR-13677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16900424#comment-16900424
 ] 

Noble Paul edited comment on SOLR-13677 at 8/6/19 4:46 AM:
-----------------------------------------------------------

bq. In {{SolrMetricProducer}} instead of using {{AutoCloseable.close()}} simply 
add a different default method eg. {{unregisterMetrics()}}.

I thought of doing it. But the problem is that there is a chance that 
{{unregisterMetrics()}} is not invoked at all, as it is not the responsibility 
of the metrics framework. {{AutoCloseable.close()}} is called anyway. All the 
cleanup should be performed there. Even if we have an {{unregisterMetrics()}} 
method, we should automatically call it from the {{AutoCloseable.close()}} 
method. 

bq.I don't think we should expose {{GaugeWrapper}} outside of 
{{SolrMetricManager}}, this is really an internal detail. 

I have changed the branch to not expose the GaugeWrapper


was (Author: noble.paul):
bq. In {{SolrMetricProducer}} instead of using {{AutoCloseable.close()}} simply 
add a different default method eg. {{unregisterMetrics()}}.

I thought of doing it. But the problem is that there is a chance that 
{{unregisterMetrics()}} is not invoked at all as it is not the responsibility 
of the metrics framework. {{AutoCloseable.close()}} is called anyway and any 
and all the cleanup should be performed there. Even if we have an 
{{unregisterMetrics()}} method, we should automatically call it from the 
{{AutoCloseable.close()}} method. 

bq.I don't think we should expose {{GaugeWrapper}} outside of 
{{SolrMetricManager}}, this is really an internal detail. ..

The call to unregister should be just as simple as a method call 
{{someObject.unregister()}} . As a component writer, I don't want to gather the 
various parameters required by the metrics framework to unregister my 
component. It should be totally hidden outside of the metrics framework. I 
agree that the {{GaugeWrapper}} is an internal component. It may make sense to 
rename it and keep it as a top level class.




> All Metrics Gauges should be unregistered by the objects that registered them
> -----------------------------------------------------------------------------
>
>                 Key: SOLR-13677
>                 URL: https://issues.apache.org/jira/browse/SOLR-13677
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: metrics
>            Reporter: Noble Paul
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The life cycle of Metrics producers are managed by the core (mostly). So, if 
> the lifecycle of the object is different from that of the core itself, these 
> objects will never be unregistered from the metrics registry. This will lead 
> to memory leaks



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to