You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "fanshilun (Jira)" <ji...@apache.org> on 2022/10/02 23:57:00 UTC

[jira] [Updated] (YARN-11324) [Federation] Fix some PBImpl classes to avoid NPE.

     [ https://issues.apache.org/jira/browse/YARN-11324?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

fanshilun updated YARN-11324:
-----------------------------
    Summary: [Federation] Fix some PBImpl classes to avoid NPE.  (was: [Federation] Fix some PBImpl classes may have null pointer exception.)

> [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: Bug
>          Components: federation, router, yarn
>    Affects Versions: 3.4.0
>            Reporter: fanshilun
>            Assignee: fanshilun
>            Priority: Major
>         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-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org