Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-11932

BPServiceActor thread name is not correctly set

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.9.0, 3.0.0-alpha4, 2.8.2
    • Component/s: hdfs
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      When running unit tests (e.g. TestJMXGet), we often get this following exception, although the tests still passed:

      WARN  datanode.DataNode (BPOfferService.java:getBlockPoolId(192)) - Block pool ID needed, but service not yet registered with NN
      java.lang.Exception: trace 
      at org.apache.hadoop.hdfs.server.datanode.BPOfferService.getBlockPoolId(BPOfferService.java:192) at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.formatThreadName(BPServiceActor.java:556) at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.start(BPServiceActor.java:544) at 
      ...
      

      It seems that, although this does not affect normal operations, this is causing the thread name of BPServiceActor not correctly set as desired. More specifically,:

       bpThread = new Thread(this, formatThreadName("heartbeating", nnAddr));
       bpThread.setDaemon(true); // needed for JUnit testing
       bpThread.start();
      

      The first line tries to call formatThreadName to get format a thread name, and formatThreadName is reading the value of BPOfferService#bpNSInfo. However this value is set only after the thread started (the third line above). So we get exception in the first line for reading non-existing value.

      1. HDFS-11932.001.patch
        2 kB
        Chen Liang
      2. HDFS-11932.002.patch
        2 kB
        Chen Liang

        Activity

        Hide
        vagarychen Chen Liang added a comment -

        Post v001 patch to set the thread name after the thread gets started and namespace info is set. Also slightly modified a log message as I found it confusing when debugging this exception.

        Show
        vagarychen Chen Liang added a comment - Post v001 patch to set the thread name after the thread gets started and namespace info is set. Also slightly modified a log message as I found it confusing when debugging this exception.
        Hide
        hanishakoneru Hanisha Koneru added a comment -

        The thread name is already being set with NamespaceInfo included in BPServiceActor#connectToNNAndHandshake.

             /* set thread name again to include NamespaceInfo when it's available. */
            this.bpThread.setName(formatThreadName("heartbeating", nnAddr));
        

        So setting it again after this function is called would be redundant.

                  connectToNNAndHandshake();
                  Thread.currentThread().setName(
                      formatThreadName("heartbeating", nnAddr));
        

        We can just not set the thread name during initialization to avoid the warning message.

        Show
        hanishakoneru Hanisha Koneru added a comment - The thread name is already being set with NamespaceInfo included in BPServiceActor#connectToNNAndHandshake . /* set thread name again to include NamespaceInfo when it's available. */ this .bpThread.setName(formatThreadName( "heartbeating" , nnAddr)); So setting it again after this function is called would be redundant. connectToNNAndHandshake(); Thread .currentThread().setName( formatThreadName( "heartbeating" , nnAddr)); We can just not set the thread name during initialization to avoid the warning message.
        Hide
        vagarychen Chen Liang added a comment -

        Thanks Hanisha Koneru for the catch! Post v002 patch.

        Show
        vagarychen Chen Liang added a comment - Thanks Hanisha Koneru for the catch! Post v002 patch.
        Hide
        arpitagarwal Arpit Agarwal added a comment -

        +1 pending Jenkins.

        Show
        arpitagarwal Arpit Agarwal added a comment - +1 pending Jenkins.
        Hide
        hadoopqa Hadoop QA added a comment -
        -1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 16s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
        +1 mvninstall 14m 48s trunk passed
        +1 compile 0m 52s trunk passed
        +1 checkstyle 0m 39s trunk passed
        +1 mvnsite 1m 1s trunk passed
        +1 findbugs 1m 48s trunk passed
        +1 javadoc 0m 40s trunk passed
        +1 mvninstall 0m 55s the patch passed
        +1 compile 0m 51s the patch passed
        +1 javac 0m 51s the patch passed
        +1 checkstyle 0m 34s the patch passed
        +1 mvnsite 0m 51s the patch passed
        +1 whitespace 0m 0s The patch has no whitespace issues.
        +1 findbugs 1m 47s the patch passed
        +1 javadoc 0m 39s the patch passed
        -1 unit 66m 25s hadoop-hdfs in the patch failed.
        +1 asflicense 0m 20s The patch does not generate ASF License warnings.
        93m 46s



        Reason Tests
        Failed junit tests hadoop.hdfs.server.blockmanagement.TestRBWBlockInvalidation
          hadoop.hdfs.server.namenode.TestNamenodeCapacityReport
          hadoop.hdfs.TestDFSStripedOutputStreamWithFailure150
          hadoop.hdfs.server.datanode.TestDataNodeVolumeFailureReporting



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:14b5c93
        JIRA Issue HDFS-11932
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12871668/HDFS-11932.002.patch
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux 21b3b7c1f35a 3.13.0-107-generic #154-Ubuntu SMP Tue Dec 20 09:57:27 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
        Build tool maven
        Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
        git revision trunk / 536f057
        Default Java 1.8.0_131
        findbugs v3.1.0-RC1
        unit https://builds.apache.org/job/PreCommit-HDFS-Build/19803/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt
        Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/19803/testReport/
        modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs
        Console output https://builds.apache.org/job/PreCommit-HDFS-Build/19803/console
        Powered by Apache Yetus 0.5.0-SNAPSHOT http://yetus.apache.org

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 16s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 mvninstall 14m 48s trunk passed +1 compile 0m 52s trunk passed +1 checkstyle 0m 39s trunk passed +1 mvnsite 1m 1s trunk passed +1 findbugs 1m 48s trunk passed +1 javadoc 0m 40s trunk passed +1 mvninstall 0m 55s the patch passed +1 compile 0m 51s the patch passed +1 javac 0m 51s the patch passed +1 checkstyle 0m 34s the patch passed +1 mvnsite 0m 51s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 findbugs 1m 47s the patch passed +1 javadoc 0m 39s the patch passed -1 unit 66m 25s hadoop-hdfs in the patch failed. +1 asflicense 0m 20s The patch does not generate ASF License warnings. 93m 46s Reason Tests Failed junit tests hadoop.hdfs.server.blockmanagement.TestRBWBlockInvalidation   hadoop.hdfs.server.namenode.TestNamenodeCapacityReport   hadoop.hdfs.TestDFSStripedOutputStreamWithFailure150   hadoop.hdfs.server.datanode.TestDataNodeVolumeFailureReporting Subsystem Report/Notes Docker Image:yetus/hadoop:14b5c93 JIRA Issue HDFS-11932 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12871668/HDFS-11932.002.patch Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux 21b3b7c1f35a 3.13.0-107-generic #154-Ubuntu SMP Tue Dec 20 09:57:27 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 536f057 Default Java 1.8.0_131 findbugs v3.1.0-RC1 unit https://builds.apache.org/job/PreCommit-HDFS-Build/19803/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt Test Results https://builds.apache.org/job/PreCommit-HDFS-Build/19803/testReport/ modules C: hadoop-hdfs-project/hadoop-hdfs U: hadoop-hdfs-project/hadoop-hdfs Console output https://builds.apache.org/job/PreCommit-HDFS-Build/19803/console Powered by Apache Yetus 0.5.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
        Hide
        arpitagarwal Arpit Agarwal added a comment -

        I've committed this. Thanks for the contribution Chen Liang and thanks for the code review Hanisha Koneru.

        Show
        arpitagarwal Arpit Agarwal added a comment - I've committed this. Thanks for the contribution Chen Liang and thanks for the code review Hanisha Koneru .
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #11833 (See https://builds.apache.org/job/Hadoop-trunk-Commit/11833/)
        HDFS-11932. BPServiceActor thread name is not correctly set. Contributed (arp: rev 867903db2b38a59c86e71f1aaef3b0f9a87bfe17)

        • (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java
        • (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #11833 (See https://builds.apache.org/job/Hadoop-trunk-Commit/11833/ ) HDFS-11932 . BPServiceActor thread name is not correctly set. Contributed (arp: rev 867903db2b38a59c86e71f1aaef3b0f9a87bfe17) (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPOfferService.java (edit) hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java
        Hide
        szetszwo Tsz Wo Nicholas Sze added a comment -

        Merged this to branch-2.8.2.

        Show
        szetszwo Tsz Wo Nicholas Sze added a comment - Merged this to branch-2.8.2.

          People

          • Assignee:
            vagarychen Chen Liang
            Reporter:
            vagarychen Chen Liang
          • Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development