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 3 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-commenter commented Oct 28, 2024

Codecov Report

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

Project coverage is 0.00%. Comparing base (51b8e7b) to head (6afd052).

Files with missing lines Patch % Lines
...kyuubi/engine/KubernetesApplicationOperation.scala 0.00% 10 Missing ⚠️
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.
📢 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.

Copy link
Member Author

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)
            }
          }

Copy link

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!

@github-actions github-actions bot added the Stale label Feb 14, 2025
@github-actions github-actions bot closed this Feb 14, 2025
@pan3793 pan3793 reopened this Feb 14, 2025
@pan3793 pan3793 removed the Stale label Feb 14, 2025
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.

4 participants