Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-6421

Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.0
    • Fix Version/s: 2.8.0, 3.0.0-alpha1
    • Component/s: None
    • Labels:
      None
    • Target Version/s:
    • Hadoop Flags:
      Reviewed

      Description

      The actual error message is:

      Inconsistent synchronization of org.apache.hadoop.mapreduce.v2.app.rm.RMContainerAllocator.reduceNodeLabelExpression; locked 66% of time

      The full URL for the findbugs is at:

      https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/5858/artifact/patchprocess/trunkFindbugsWarningshadoop-mapreduce-client-app.html

      I haven't looked to see if this message is in error or if findbugs is correct.

      1. MAPREDUCE-6421-002.patch
        0.6 kB
        Brahma Reddy Battula
      2. MAPREDUCE-6421.patch
        0.6 kB
        Brahma Reddy Battula

        Issue Links

          Activity

          Hide
          rchiang Ray Chiang added a comment -

          Full message from findbugs below


          IS2_INCONSISTENT_SYNC: Inconsistent synchronization

          The fields of this class appear to be accessed inconsistently with respect to synchronization. This bug report indicates that the bug pattern detector judged that

          The class contains a mix of locked and unlocked accesses,
          The class is not annotated as javax.annotation.concurrent.NotThreadSafe,
          At least one locked access was performed by one of the class's own methods, and
          The number of unsynchronized field accesses (reads and writes) was no more than one third of all accesses, with writes being weighed twice as high as reads
          A typical bug matching this bug pattern is forgetting to synchronize one of the methods in a class that is intended to be thread-safe.

          You can select the nodes labeled "Unsynchronized access" to show the code locations where the detector believed that a field was accessed without synchronization.

          Note that there are various sources of inaccuracy in this detector; for example, the detector cannot statically detect all situations in which a lock is held. Also, even when the detector is accurate in distinguishing locked vs. unlocked accesses, the code in question may still be correct.

          Show
          rchiang Ray Chiang added a comment - Full message from findbugs below IS2_INCONSISTENT_SYNC: Inconsistent synchronization The fields of this class appear to be accessed inconsistently with respect to synchronization. This bug report indicates that the bug pattern detector judged that The class contains a mix of locked and unlocked accesses, The class is not annotated as javax.annotation.concurrent.NotThreadSafe, At least one locked access was performed by one of the class's own methods, and The number of unsynchronized field accesses (reads and writes) was no more than one third of all accesses, with writes being weighed twice as high as reads A typical bug matching this bug pattern is forgetting to synchronize one of the methods in a class that is intended to be thread-safe. You can select the nodes labeled "Unsynchronized access" to show the code locations where the detector believed that a field was accessed without synchronization. Note that there are various sources of inaccuracy in this detector; for example, the detector cannot statically detect all situations in which a lock is held. Also, even when the detector is accurate in distinguishing locked vs. unlocked accesses, the code in question may still be correct.
          Hide
          ajisakaa Akira Ajisaka added a comment -

          A quick fix is to synchronize the following code:

              reduceNodeLabelExpression = conf.get(MRJobConfig.REDUCE_NODE_LABEL_EXP);
          

          What do you think Ray Chiang and Brahma Reddy Battula?

          Show
          ajisakaa Akira Ajisaka added a comment - A quick fix is to synchronize the following code: reduceNodeLabelExpression = conf.get(MRJobConfig.REDUCE_NODE_LABEL_EXP); What do you think Ray Chiang and Brahma Reddy Battula ?
          Hide
          rchiang Ray Chiang added a comment -

          The above statement is in RMContainerAllocator#serviceInit() and the other read accesses in RMContainerAllocator#handleEvent(). Synchronizing reduceNodeLabelExpression in the former method wouldn't be too much of a penalty to get findbugs clean (or someone can correct me on that).

          I think it would take a lot more effort to make RMContainerAllocator#handleEvent() thread-safe in a more fine-grained fashion. I'm not familiar enough with the code to know if would actually be worth doing at all.

          Show
          rchiang Ray Chiang added a comment - The above statement is in RMContainerAllocator#serviceInit() and the other read accesses in RMContainerAllocator#handleEvent(). Synchronizing reduceNodeLabelExpression in the former method wouldn't be too much of a penalty to get findbugs clean (or someone can correct me on that). I think it would take a lot more effort to make RMContainerAllocator#handleEvent() thread-safe in a more fine-grained fashion. I'm not familiar enough with the code to know if would actually be worth doing at all.
          Hide
          ajisakaa Akira Ajisaka added a comment -

          Thanks Ray Chiang for the comment.

          Synchronizing reduceNodeLabelExpression in the former method wouldn't be too much of a penalty to get findbugs clean (or someone can correct me on that).

          Agree. I found some other variables in the class are already in the exclude list.

          hadoop-mapreduce-project/dev-support/findbugs-exclude.xml
             <Match>
               <Class name="org.apache.hadoop.mapreduce.v2.app.rm.RMContainerAllocator" />
               <Or>
                <Field name="mapResourceRequest" />
                <Field name="reduceResourceRequest" />
                <Field name="maxReduceRampupLimit" />
                <Field name="reduceSlowStart" />
               </Or>
               <Bug pattern="IS2_INCONSISTENT_SYNC" />
             </Match>
          

          I'm okay with adding the field in the file.

          I think it would take a lot more effort to make RMContainerAllocator#handleEvent() thread-safe in a more fine-grained fashion.

          It seems difficult to me. Probably it needs an annotation or something such as @Beforeclass in junit.

          Show
          ajisakaa Akira Ajisaka added a comment - Thanks Ray Chiang for the comment. Synchronizing reduceNodeLabelExpression in the former method wouldn't be too much of a penalty to get findbugs clean (or someone can correct me on that). Agree. I found some other variables in the class are already in the exclude list. hadoop-mapreduce-project/dev-support/findbugs-exclude.xml <Match> < Class name= "org.apache.hadoop.mapreduce.v2.app.rm.RMContainerAllocator" /> <Or> <Field name= "mapResourceRequest" /> <Field name= "reduceResourceRequest" /> <Field name= "maxReduceRampupLimit" /> <Field name= "reduceSlowStart" /> </Or> <Bug pattern= "IS2_INCONSISTENT_SYNC" /> </Match> I'm okay with adding the field in the file. I think it would take a lot more effort to make RMContainerAllocator#handleEvent() thread-safe in a more fine-grained fashion. It seems difficult to me. Probably it needs an annotation or something such as @Beforeclass in junit.
          Hide
          brahmareddy Brahma Reddy Battula added a comment -

          Hmm, Yes..we need to add to exclude list..

          Show
          brahmareddy Brahma Reddy Battula added a comment - Hmm, Yes..we need to add to exclude list..
          Hide
          hadoopqa Hadoop QA added a comment -



          -1 overall



          Vote Subsystem Runtime Comment
          0 pre-patch 0m 0s Pre-patch trunk compilation is healthy.
          +1 @author 0m 0s The patch does not contain any @author tags.
          +1 release audit 0m 15s The applied patch does not increase the total number of release audit warnings.
          -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix.
              0m 18s  



          Subsystem Report/Notes
          Patch URL http://issues.apache.org/jira/secure/attachment/12744689/MAPREDUCE-6421.patch
          Optional Tests  
          git revision trunk / d66302e
          whitespace https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/5880/artifact/patchprocess/whitespace.txt
          Java 1.7.0_55
          uname Linux asf903.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Console output https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/5880/console

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 pre-patch 0m 0s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. +1 release audit 0m 15s The applied patch does not increase the total number of release audit warnings. -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix.     0m 18s   Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12744689/MAPREDUCE-6421.patch Optional Tests   git revision trunk / d66302e whitespace https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/5880/artifact/patchprocess/whitespace.txt Java 1.7.0_55 uname Linux asf903.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/5880/console This message was automatically generated.
          Hide
          brahmareddy Brahma Reddy Battula added a comment -

          Attached the patch to fix whitespace.

          Show
          brahmareddy Brahma Reddy Battula added a comment - Attached the patch to fix whitespace.
          Hide
          hadoopqa Hadoop QA added a comment -



          +1 overall



          Vote Subsystem Runtime Comment
          0 pre-patch 0m 0s Pre-patch trunk compilation is healthy.
          +1 @author 0m 0s The patch does not contain any @author tags.
          +1 release audit 0m 20s The applied patch does not increase the total number of release audit warnings.
          +1 whitespace 0m 0s The patch has no lines that end in whitespace.
              0m 23s  



          Subsystem Report/Notes
          Patch URL http://issues.apache.org/jira/secure/attachment/12744690/MAPREDUCE-6421-002.patch
          Optional Tests  
          git revision trunk / b489080
          Java 1.7.0_55
          uname Linux asf904.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
          Console output https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/5881/console

          This message was automatically generated.

          Show
          hadoopqa Hadoop QA added a comment - +1 overall Vote Subsystem Runtime Comment 0 pre-patch 0m 0s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. +1 release audit 0m 20s The applied patch does not increase the total number of release audit warnings. +1 whitespace 0m 0s The patch has no lines that end in whitespace.     0m 23s   Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12744690/MAPREDUCE-6421-002.patch Optional Tests   git revision trunk / b489080 Java 1.7.0_55 uname Linux asf904.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-MAPREDUCE-Build/5881/console This message was automatically generated.
          Hide
          ajisakaa Akira Ajisaka added a comment -

          +1, I verified the v2 patch fixes the warning. I'll commit this shortly.

          Show
          ajisakaa Akira Ajisaka added a comment - +1, I verified the v2 patch fixes the warning. I'll commit this shortly.
          Hide
          ajisakaa Akira Ajisaka added a comment -

          I've committed this to trunk and branch-2. Thanks Ray Chiang and Brahma Reddy Battula for contributing to this issue.

          Show
          ajisakaa Akira Ajisaka added a comment - I've committed this to trunk and branch-2. Thanks Ray Chiang and Brahma Reddy Battula for contributing to this issue.
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Hadoop-trunk-Commit #8155 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8155/)
          MAPREDUCE-6421. Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff)

          • hadoop-mapreduce-project/dev-support/findbugs-exclude.xml
          • hadoop-mapreduce-project/CHANGES.txt
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-trunk-Commit #8155 (See https://builds.apache.org/job/Hadoop-trunk-Commit/8155/ ) MAPREDUCE-6421 . Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff) hadoop-mapreduce-project/dev-support/findbugs-exclude.xml hadoop-mapreduce-project/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #255 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/255/)
          MAPREDUCE-6421. Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff)

          • hadoop-mapreduce-project/CHANGES.txt
          • hadoop-mapreduce-project/dev-support/findbugs-exclude.xml
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk-Java8 #255 (See https://builds.apache.org/job/Hadoop-Yarn-trunk-Java8/255/ ) MAPREDUCE-6421 . Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff) hadoop-mapreduce-project/CHANGES.txt hadoop-mapreduce-project/dev-support/findbugs-exclude.xml
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Yarn-trunk #985 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/985/)
          MAPREDUCE-6421. Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff)

          • hadoop-mapreduce-project/dev-support/findbugs-exclude.xml
          • hadoop-mapreduce-project/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Yarn-trunk #985 (See https://builds.apache.org/job/Hadoop-Yarn-trunk/985/ ) MAPREDUCE-6421 . Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff) hadoop-mapreduce-project/dev-support/findbugs-exclude.xml hadoop-mapreduce-project/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #243 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/243/)
          MAPREDUCE-6421. Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff)

          • hadoop-mapreduce-project/dev-support/findbugs-exclude.xml
          • hadoop-mapreduce-project/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk-Java8 #243 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk-Java8/243/ ) MAPREDUCE-6421 . Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff) hadoop-mapreduce-project/dev-support/findbugs-exclude.xml hadoop-mapreduce-project/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          FAILURE: Integrated in Hadoop-Hdfs-trunk #2182 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2182/)
          MAPREDUCE-6421. Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff)

          • hadoop-mapreduce-project/dev-support/findbugs-exclude.xml
          • hadoop-mapreduce-project/CHANGES.txt
          Show
          hudson Hudson added a comment - FAILURE: Integrated in Hadoop-Hdfs-trunk #2182 (See https://builds.apache.org/job/Hadoop-Hdfs-trunk/2182/ ) MAPREDUCE-6421 . Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff) hadoop-mapreduce-project/dev-support/findbugs-exclude.xml hadoop-mapreduce-project/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Hadoop-Mapreduce-trunk #2201 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2201/)
          MAPREDUCE-6421. Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff)

          • hadoop-mapreduce-project/dev-support/findbugs-exclude.xml
          • hadoop-mapreduce-project/CHANGES.txt
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-Mapreduce-trunk #2201 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk/2201/ ) MAPREDUCE-6421 . Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff) hadoop-mapreduce-project/dev-support/findbugs-exclude.xml hadoop-mapreduce-project/CHANGES.txt
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Hadoop-Mapreduce-trunk-Java8 #253 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/253/)
          MAPREDUCE-6421. Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff)

          • hadoop-mapreduce-project/CHANGES.txt
          • hadoop-mapreduce-project/dev-support/findbugs-exclude.xml
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Hadoop-Mapreduce-trunk-Java8 #253 (See https://builds.apache.org/job/Hadoop-Mapreduce-trunk-Java8/253/ ) MAPREDUCE-6421 . Fix findbugs warning in RMContainerAllocator.reduceNodeLabelExpression. Contributed by Brahma Reddy Battula. (aajisaka: rev e04faf8e462a24a3ddfd8f22050e74eda4aa19ff) hadoop-mapreduce-project/CHANGES.txt hadoop-mapreduce-project/dev-support/findbugs-exclude.xml

            People

            • Assignee:
              brahmareddy Brahma Reddy Battula
              Reporter:
              rchiang Ray Chiang
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development