Github user StefanRRichter commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5959#discussion_r190165058
  
    --- 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 --
    
    This looks potentially still broken to me because it does double-checked 
locking, which is a defective anti-pattern.


---

Reply via email to