wangdengshan created LIVY-1002:
----------------------------------

             Summary: LivyThriftSessionManager killSparkApp may have NPE
                 Key: LIVY-1002
                 URL: https://issues.apache.org/jira/browse/LIVY-1002
             Project: Livy
          Issue Type: Bug
          Components: Thriftserver
    Affects Versions: 0.8.0
            Reporter: wangdengshan


There may be a null pointer exception in killSparkApp. sparkApps will only put 
after the session is created. When the creation process fails, the kill 
application will not be successful.

Below is my runtime stack:

{color:#ff8b00}2024-05-30 03:39:12 [ERROR] [LivyServer2-Background-Pool: 
Thread-139977] org.apache.livy.thriftserver.LivyThriftSessionManager:error:58 - 
Kill application failed{color}
{color:#ff8b00}java.lang.NullPointerException{color}
{color:#ff8b00}        at 
org.apache.livy.thriftserver.LivyThriftSessionManager.killSparkApp$1(LivyThriftSessionManager.scala:148){color}
{color:#ff8b00}        at 
org.apache.livy.thriftserver.LivyThriftSessionManager.getLivySession(LivyThriftSessionManager.scala:180){color}
{color:#ff8b00}        at 
org.apache.livy.thriftserver.LivyExecuteStatementOperation.execute(LivyExecuteStatementOperation.scala:157){color}
{color:#ff8b00}        at 
org.apache.livy.thriftserver.LivyExecuteStatementOperation$$anon$1$$anon$2.run(LivyExecuteStatementOperation.scala:102){color}
{color:#ff8b00}        at 
org.apache.livy.thriftserver.LivyExecuteStatementOperation$$anon$1$$anon$2.run(LivyExecuteStatementOperation.scala:99){color}
{color:#ff8b00}        at java.security.AccessController.doPrivileged(Native 
Method){color}
{color:#ff8b00}        at 
javax.security.auth.Subject.doAs(Subject.java:422){color}
{color:#ff8b00}        at 
org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:2248){color}
{color:#ff8b00}        at 
org.apache.livy.thriftserver.LivyExecuteStatementOperation$$anon$1.run(LivyExecuteStatementOperation.scala:112){color}
{color:#ff8b00}        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511){color}
{color:#ff8b00}        at 
java.util.concurrent.FutureTask.run(FutureTask.java:266){color}
{color:#ff8b00}        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149){color}
{color:#ff8b00}        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624){color}
{color:#ff8b00}        at java.lang.Thread.run(Thread.java:748){color}

 

{color:#172b4d}The key code is here{color}
{code:java}
    def killSparkApp = {
      try {
        sparkApps.get(sessionHandle.toString).foreach(sparkApp => {
          info("Start kill spark job")
          sparkApp.kill()
          info("End kill spark job")
        })
      } catch {
        case ex: Throwable => error("Kill application failed", ex)
      } finally {
        sparkApps.remove(sessionHandle.toString)
      }
    }
 {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to