Github user StefanRRichter commented on a diff in the pull request: https://github.com/apache/flink/pull/5959#discussion_r190165634 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/ComponentMetricGroup.java --- @@ -57,11 +57,12 @@ public ComponentMetricGroup(MetricRegistry registry, String[] scope, P parent) { if (variables == null) { // avoid synchronization for common case synchronized (this) { if (variables == null) { - variables = new HashMap<>(); - putVariables(variables); + Map<String, String> tmpVariables = new HashMap<>(); + putVariables(tmpVariables); if (parent != null) { // not true for Job-/TaskManagerMetricGroup - variables.putAll(parent.getAllVariables()); + tmpVariables.putAll(parent.getAllVariables()); } + variables = tmpVariables; --- End diff -- To be clear, this is not exactly about the fixed lines, but the line that is commented with "optimization for common case" is the remaining problem.
---