[ 
https://issues.apache.org/jira/browse/SPARK-22519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16251925#comment-16251925
 ] 

Devaraj K commented on SPARK-22519:
-----------------------------------

It is not an usual case, I have seen this NPE while working SPARK-22404 when 
the SPARK_YARN_STAGING_DIR env doesn't exist. If you don't think to have a null 
check for env, atleast the *if (stagingDirPath == null) {* is never used.

> ApplicationMaster.cleanupStagingDir() throws NPE when SPARK_YARN_STAGING_DIR 
> env var is not available
> -----------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-22519
>                 URL: https://issues.apache.org/jira/browse/SPARK-22519
>             Project: Spark
>          Issue Type: Improvement
>          Components: YARN
>    Affects Versions: 2.2.0
>            Reporter: Devaraj K
>            Priority: Minor
>
> In the below, the condition checks whether the stagingDirPath is null but 
> stagingDirPath never becomes null. If SPARK_YARN_STAGING_DIR env var is null 
> then it throws NPE while creating the Path.
> {code:title=ApplicationMaster.scala|borderStyle=solid}
>         stagingDirPath = new Path(System.getenv("SPARK_YARN_STAGING_DIR"))
>         if (stagingDirPath == null) {
>           logError("Staging directory is null")
>           return
>         }
> {code}
> Here we need to check whether the System.getenv("SPARK_YARN_STAGING_DIR") is 
> null or not, not the stagingDirPath.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to