[ https://issues.apache.org/jira/browse/YARN-11324?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Shilun Fan updated YARN-11324: ------------------------------ Hadoop Flags: Reviewed > [Federation] Fix some PBImpl classes to avoid NPE. > -------------------------------------------------- > > Key: YARN-11324 > URL: https://issues.apache.org/jira/browse/YARN-11324 > Project: Hadoop YARN > Issue Type: Sub-task > Components: federation, router, yarn > Affects Versions: 3.4.0 > Reporter: Shilun Fan > Assignee: Shilun Fan > Priority: Major > Labels: pull-request-available > Fix For: 3.4.0 > > Attachments: image-2022-09-30-16-52-25-031.png > > > When completing YARN-11323, I found that there is a bug in > ApplicationHomeSubClusterPBImpl, which may cause a null pointer exception > when getting getApplicationId > {code:java} > @Test > public void testGetApplicationIdNullException() throws YarnException { > ApplicationId appId = ApplicationId.newInstance(Time.now(), 1); > ApplicationHomeSubCluster appHomeSC = ApplicationHomeSubCluster.newInstance( > appId, subClusterId); > System.out.println(appHomeSC.getApplicationId()); > } {code} > The test results are as follows: > !image-2022-09-30-16-52-25-031.png|width=818,height=271! > > 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. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org