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

Chesnay Schepler commented on FLINK-14565:
------------------------------------------

I would disagree that the {{SystemResourcesCounter}} is bound to any metric 
group.
Ultimately, the SRC is a separate entity populating _some_ data-structure, from 
which _some_ metrics are created which are then passed to the metric system.

The counter may continue to exist with the group being closed, just as the 
metric group can continue to exist with the counter having shut down.

The {{SystemResourcesCounter}} probably shouldn't be spawning a separate thread 
in the first place; let me think a bit to find way how we can workaround this.

> Shutdown SystemResourcesCounter on (JM|TM)MetricGroup closed
> ------------------------------------------------------------
>
>                 Key: FLINK-14565
>                 URL: https://issues.apache.org/jira/browse/FLINK-14565
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Metrics
>            Reporter: Zili Chen
>            Assignee: Zili Chen
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently, we start SystemResourcesCounter when initialize 
> (JM|TM)MetricGroup. This thread doesn't exit on (JM|TM)MetricGroup closed and 
> even there is not exit logic of them.
> It possibly causes thread leak. For example, on our platform which supports 
> previewing sample SQL execution, it starts a MiniCluster in the same process 
> as the platform. When the preview job finished MiniCluster closed and also 
> (JM|TM)MetricGroup. However these SystemResourcesCounter threads remain.
> I propose when creating SystemResourcesCounter, track it in 
> (JM|TM)MetricGroup, and on (JM|TM)MetricGroup closed, shutdown 
> SystemResourcesCounter. This way, we survive from thread leaks.
> CC [~chesnay] [~trohrmann]



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

Reply via email to