Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-5597 YARN Federation improvements
  3. YARN-11324

[Federation] Fix some PBImpl classes to avoid NPE.

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      When completing YARN-11323, I found that there is a bug in ApplicationHomeSubClusterPBImpl, which may cause a null pointer exception when getting getApplicationId

      @Test
      public void testGetApplicationIdNullException() throws YarnException {
        ApplicationId appId = ApplicationId.newInstance(Time.now(), 1);
        ApplicationHomeSubCluster appHomeSC = ApplicationHomeSubCluster.newInstance(
            appId, subClusterId);
        System.out.println(appHomeSC.getApplicationId());
      } 

      The test results are as follows:

       

      After we set the ApplicationId, direct get will get a null value.

      Why this problem occurs?

      The reason for this problem is because we did not set a value for ApplicationHomeSubClusterProtoOrBuilder when we setApplication

      Improve the code:

      1.set a value for ApplicationHomeSubClusterProtoOrBuilder when we setApplication.

      2. At the same time, in order to improve the access efficiency, we should first check whether the internal property is empty when getApplication. If it is not empty, we can return it directly. If it is empty, we convert it from the proto object.

      While modifying ApplicationHomeSubClusterImpl, I will check the pbImpl classes of all router modules to make sure all pbimpl are fixed.

      Attachments

        Activity

          People

            slfan1989 Shilun Fan
            slfan1989 Shilun Fan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: