You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2022/04/29 04:54:00 UTC
[incubator-kyuubi] branch master updated: [KYUUBI #2510] Fix NPE when invoking YarnApplicationOperation::getApplicationInfoByTag
This is an automated email from the ASF dual-hosted git repository.
feiwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new c0963e1b2 [KYUUBI #2510] Fix NPE when invoking YarnApplicationOperation::getApplicationInfoByTag
c0963e1b2 is described below
commit c0963e1b2ffaf79169130d16a3c55da85032ec26
Author: Fei Wang <fw...@ebay.com>
AuthorDate: Fri Apr 29 12:53:52 2022 +0800
[KYUUBI #2510] Fix NPE when invoking YarnApplicationOperation::getApplicationInfoByTag
### _Why are the changes needed?_
null value might be returned for YarnApplicationOperation::getApplicationInfoByTag
I met NPE issue yesterday.
<img width="1061" alt="image" src="https://user-images.githubusercontent.com/6757692/165871836-ad1e4290-34ee-4941-9463-6cc4384f502e.png">
<img width="1329" alt="image" src="https://user-images.githubusercontent.com/6757692/165871885-3b216dda-ab4f-4663-966d-15c0be5f110f.png">
Here the state might be null, because Some(null) is nonEmpty.
### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
Closes #2510 from turboFei/batch_npe.
Closes #2510
32cad243 [Fei Wang] refactor
f0e5f11a [Fei Wang] fix current ut
f037d447 [Fei Wang] fix npe when getting ApplicationInfo
Authored-by: Fei Wang <fw...@ebay.com>
Signed-off-by: Fei Wang <fw...@ebay.com>
---
.../scala/org/apache/kyuubi/engine/KyuubiApplicationManager.scala | 6 +++++-
.../org/apache/kyuubi/operation/KyuubiBatchYarnClusterSuite.scala | 5 ++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KyuubiApplicationManager.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KyuubiApplicationManager.scala
index 4d5e488cb..d38376bad 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KyuubiApplicationManager.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KyuubiApplicationManager.scala
@@ -78,7 +78,11 @@ class KyuubiApplicationManager extends AbstractService("KyuubiApplicationManager
def getApplicationInfo(
clusterManager: Option[String],
tag: String): Option[Map[String, String]] = {
- operations.find(_.isSupported(clusterManager)).map(_.getApplicationInfoByTag(tag))
+ val operation = operations.find(_.isSupported(clusterManager))
+ operation match {
+ case Some(op) => Option(op.getApplicationInfoByTag(tag))
+ case None => None
+ }
}
}
diff --git a/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/KyuubiBatchYarnClusterSuite.scala b/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/KyuubiBatchYarnClusterSuite.scala
index b1748a2b9..dd9507882 100644
--- a/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/KyuubiBatchYarnClusterSuite.scala
+++ b/kyuubi-server/src/test/scala/org/apache/kyuubi/operation/KyuubiBatchYarnClusterSuite.scala
@@ -80,7 +80,10 @@ class KyuubiBatchYarnClusterSuite extends WithKyuubiServerOnYarn {
val appInfo = yarnOperation.getApplicationInfoByTag(sessionHandle.identifier.toString)
assert(appInfo("state") === "KILLED")
- assert(batchJobSubmissionOp.getStatus.state === ERROR)
+
+ eventually(timeout(10.seconds), interval(50.milliseconds)) {
+ assert(batchJobSubmissionOp.getStatus.state === ERROR)
+ }
val resultColumns = batchJobSubmissionOp.getNextRowSet(FetchOrientation.FETCH_NEXT, 10)
.getColumns.asScala