[
https://issues.apache.org/jira/browse/FLINK-8213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16287653#comment-16287653
]
ASF GitHub Bot commented on FLINK-8213:
---------------------------------------
Github user aljoscha commented on a diff in the pull request:
https://github.com/apache/flink/pull/5154#discussion_r156371977
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/JobMaster.java
---
@@ -264,8 +264,8 @@ public JobMaster(
this.jobManagerMetricGroup = jobManagerMetricGroup;
this.jobMetricGroup =
jobManagerMetricGroup.addJob(jobGraph);
} else {
- this.jobManagerMetricGroup = new
UnregisteredMetricsGroup();
- this.jobMetricGroup = new UnregisteredMetricsGroup();
+ this.jobManagerMetricGroup =
UnregisteredMetricGroups.JOB_MANAGER;
--- End diff --
I think those static fields are not available anymore so this commit alone
would not compile
> Prevent potential metric-related ClassCastExceptions
> ----------------------------------------------------
>
> Key: FLINK-8213
> URL: https://issues.apache.org/jira/browse/FLINK-8213
> Project: Flink
> Issue Type: Bug
> Components: Metrics, Streaming
> Affects Versions: 1.5.0
> Reporter: Chesnay Schepler
> Assignee: Chesnay Schepler
> Priority: Minor
>
> There are a few places, in particular revolving around the
> {{StreamOperator}}, that may run into ClassCastExceptions.
> For example, in the {{DataSinkTask}} you can find this line:
> {{final Counter numRecordsIn = ((OperatorMetricGroup)
> ctx.getMetricGroup()).getIOMetricGroup().getNumRecordsInCounter();}}
> The cast here is necessary since the {{AbstractStreamOperator}} exposes the
> {{OperatorMetricGroup}} as a plain {{MetricGroup}} since it is an internal
> class. However there is obviously no guarantee that
> {{StreamOperator#getMetricGroup()}} returns an actual
> {{OperatorMetricGroup}}. In fact, a fall-back case in
> {{AbstractStreamOperator#setup}} causes exactly this assumption to be
> violated.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)