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

Nikolay Izhikov commented on IGNITE-12769:
------------------------------------------

[~agura]

It seems to me that this issue is invalid.
{OpenCensusMetricExporterSpi} and {MetricRegistryMBean} keeps up to date 
{histogramNames} cache.

I want to close this ticket as "Not a Problem". What do you think?

1. On the {MetricRegistry} removal all cache for OpenCensus exporter will be 
cleared in 
{code:java}
    /** {@inheritDoc} */
    @Override public void spiStart(@Nullable String igniteInstanceName) throws 
IgniteSpiException {
        // ....
        mreg.addMetricRegistryRemoveListener(mreg -> mreg.forEach(metric -> 
histogramNames.remove(metric.name())));
    }
{code}

2. On the {MetricRegistry} removal bean for JMX will be unregistered therefore 
it will be collected by GC:
{code:java}
    /** {@inheritDoc} */
    @Override public void spiStart(@Nullable String igniteInstanceName) throws 
IgniteSpiException {
        // ....
        mreg.addMetricRegistryRemoveListener(this::unregister);
    }
{code}

3. On the configuration change cache for the specific histogram will be 
refreshed in(this applies to the both - JMX and OpenCencus exporters).
{code:java}
    public static String[] histogramBucketNames(HistogramMetric metric, 
Map<String, T2<long[], String[]>> cache) {
        // ....

        T2<long[], String[]> tuple = cache.get(name);

        if (tuple != null && tuple.get1() == bounds) //bounds will be changed 
on configu change.
            return tuple.get2();

        // ....

        cache.put(name, new T2<>(bounds, names)); //Cache refresh.

        return names;
    }
{code}

> MetricRegistryMBean and OpenCensusExporterSpi have memory leak
> --------------------------------------------------------------
>
>                 Key: IGNITE-12769
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12769
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Andrey N. Gura
>            Assignee: Nikolay Izhikov
>            Priority: Major
>             Fix For: 2.8.1
>
>
> {{MetricRegistryMBean}} and {{OpenCensusExporterSpi}} have memory leak. 
> To the following maps values add but never remove (i.e. on remove 
> corresponding histogram or on change histogram buckets layout):
> * {{MetricRegistryMBean.histogramNames}}
> * {{OpenCensusMetricExporterSpi.histogramNames}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to