-
Notifications
You must be signed in to change notification settings - Fork 949
Shutdown the executor service in KubernetesApplicationOperation and prevent NPE #6785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6785 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 688 688
Lines 42598 42605 +7
Branches 5807 5809 +2
======================================
- Misses 42598 42605 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
@@ -273,6 +274,16 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging { | |||
Utils.tryLogNonFatalError(client.close()) | |||
} | |||
kubernetesClients.clear() | |||
|
|||
if (expireCleanUpTriggerCacheExecutor != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may need to be placed before assigning cleanupTerminatedAppInfoTrigger to null.
kyuubi/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
Line 267 in d3520dd
if (cleanupTerminatedAppInfoTrigger != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we need to invalidate the cache before shutdown the executor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that, the remaining terminated application can be cleaned before server stop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The non-null check here is not atomic, so NPE may still occur.
kyuubi/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
Line 154 in 78c2a6c
if (cleanupTerminatedAppInfoTrigger == null) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about?
Option(cleanupTerminatedAppInfoTrigger).foreach { trigger =>
trigger.asMap().asScala.foreach {
case (key, _) =>
// do get to trigger cache eviction
trigger.getIfPresent(key)
}
}
Thanks for the PR! This PR is being closed due to inactivity. This isn't a judgement on the merit of the PR in any way. If this is still an issue with the latest version of Kyuubi, please reopen it and ask a committer to remove the Stale tag! Thank you for using Kyuubi! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
…Operation and prevent NPE # 🔍 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 🔖 - [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 ⚰️ #### Behavior With This Pull Request 🎉 #### 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 6afd052 [Wang, Fei] comments f0c3e31 [Wang, Fei] prevent npe 9dffe01 [Wang, Fei] shutdown Authored-by: Wang, Fei <[email protected]> Signed-off-by: Wang, Fei <[email protected]> (cherry picked from commit 338206e) Signed-off-by: Wang, Fei <[email protected]>
…Operation and prevent NPE # 🔍 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 🔖 - [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 ⚰️ #### Behavior With This Pull Request 🎉 #### 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 6afd052 [Wang, Fei] comments f0c3e31 [Wang, Fei] prevent npe 9dffe01 [Wang, Fei] shutdown Authored-by: Wang, Fei <[email protected]> Signed-off-by: Wang, Fei <[email protected]> (cherry picked from commit 338206e) Signed-off-by: Wang, Fei <[email protected]>
thanks, merged to master, branch-1.10 and branch-1.9 |
🔍 Description
Issue References 🔗
As title.
Fix NPE, because the cleanupTerminatedAppInfoTrigger will be set to
null
.kyuubi/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
Line 269 in d3520dd
Also shutdown the ExecutorService when KubernetesApplicationOperation stoped.
Describe Your Solution 🔧
Shutdown the thread executor service and check the null.
Types of changes 🔖
Test Plan 🧪
Behavior Without This Pull Request ⚰️
Behavior With This Pull Request 🎉
Related Unit Tests
Checklist 📝
Be nice. Be informative.