Skip to content
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

Shutdown the executor service in KubernetesApplicationOperation and prevent NPE #6785

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

turboFei
Copy link
Member

@turboFei turboFei commented Oct 28, 2024

🔍 Description

Issue References 🔗

As title.

Fix NPE, because the cleanupTerminatedAppInfoTrigger will be set to null.

Also shutdown the ExecutorService when KubernetesApplicationOperation stoped.

Describe Your Solution 🔧

Shutdown the thread executor service and check the null.

Types of changes 🔖

  • 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 📝

Be nice. Be informative.

@turboFei turboFei changed the title Npe k8s Shutdown the executor service in KubernetesApplicationOperation and prevent NPE Oct 28, 2024
@turboFei turboFei requested a review from pan3793 October 28, 2024 20:02
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (d3520dd) to head (78c2a6c).

Files with missing lines Patch % Lines
...kyuubi/engine/KubernetesApplicationOperation.scala 0.00% 7 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master   #6785   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files         687     687           
  Lines       42439   42447    +8     
  Branches     5793    5796    +3     
======================================
- Misses      42439   42447    +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -273,6 +274,16 @@ class KubernetesApplicationOperation extends ApplicationOperation with Logging {
Utils.tryLogNonFatalError(client.close())
}
kubernetesClients.clear()

if (expireCleanUpTriggerCacheExecutor != null) {
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants