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/kyuubi.git
The following commit(s) were added to refs/heads/master by this push:
new 338206e8a7 [KYUUBI #6785] Shutdown the executor service in
KubernetesApplicationOperation and prevent NPE
338206e8a7 is described below
commit 338206e8a7401f89101c7f779edc1adf097b0c7f
Author: Wang, Fei <[email protected]>
AuthorDate: Sun Mar 23 13:19:22 2025 -0700
[KYUUBI #6785] Shutdown the executor service in
KubernetesApplicationOperation and prevent NPE
# :mag: Description
## Issue References ๐
As title.
Fix NPE, because the cleanupTerminatedAppInfoTrigger will be set to `null`.
https://github.com/apache/kyuubi/blob/d3520ddbcea96ec55c525600126047c44c7adb35/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala#L269
Also shutdown the ExecutorService when KubernetesApplicationOperation
stoped.
## Describe Your Solution ๐ง
Shutdown the thread executor service and check the null.
## Types of changes :bookmark:
- [x] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
## Test Plan ๐งช
#### Behavior Without This Pull Request :coffin:
#### Behavior With This Pull Request :tada:
#### Related Unit Tests
---
# Checklist ๐
- [x] This patch was not authored or co-authored using [Generative
Tooling](https://www.apache.org/legal/generative-tooling.html)
**Be nice. Be informative.**
Closes #6785 from turboFei/npe_k8s.
Closes #6785
6afd052e6 [Wang, Fei] comments
f0c3e3134 [Wang, Fei] prevent npe
9dffe0125 [Wang, Fei] shutdown
Authored-by: Wang, Fei <[email protected]>
Signed-off-by: Wang, Fei <[email protected]>
---
.../engine/KubernetesApplicationOperation.scala | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
index 74dc398f05..59faee4868 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
@@ -151,10 +151,12 @@ class KubernetesApplicationOperation extends
ApplicationOperation with Logging {
expireCleanUpTriggerCacheExecutor,
() => {
try {
- cleanupTerminatedAppInfoTrigger.asMap().asScala.foreach {
- case (key, _) =>
- // do get to trigger cache eviction
- cleanupTerminatedAppInfoTrigger.getIfPresent(key)
+ Option(cleanupTerminatedAppInfoTrigger).foreach { trigger =>
+ trigger.asMap().asScala.foreach {
+ case (key, _) =>
+ // do get to trigger cache eviction
+ trigger.getIfPresent(key)
+ }
}
} catch {
case NonFatal(e) => error("Failed to evict clean up terminated app
cache", e)
@@ -273,6 +275,16 @@ class KubernetesApplicationOperation extends
ApplicationOperation with Logging {
Utils.tryLogNonFatalError(client.close())
}
kubernetesClients.clear()
+
+ if (expireCleanUpTriggerCacheExecutor != null) {
+ ThreadUtils.shutdown(expireCleanUpTriggerCacheExecutor)
+ expireCleanUpTriggerCacheExecutor = null
+ }
+
+ if (cleanupCanceledAppPodExecutor != null) {
+ ThreadUtils.shutdown(cleanupCanceledAppPodExecutor)
+ cleanupCanceledAppPodExecutor = null
+ }
}
private class SparkEnginePodEventHandler(kubernetesInfo: KubernetesInfo)