This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch branch-1.9
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.9 by this push:
     new 9fe210c8e [KYUUBI #6320] Fix terminated application pods not deleted 
issue when kyuubi server restarted
9fe210c8e is described below

commit 9fe210c8ed97d4954bdafb02ff5fba6db5879125
Author: Wang, Fei <[email protected]>
AuthorDate: Fri Apr 19 10:56:22 2024 +0800

    [KYUUBI #6320] Fix terminated application pods not deleted issue when 
kyuubi server restarted
    
    # :mag: Description
    ## Issue References ๐Ÿ”—
    
    This pull request fixes #
    
    We found that some pods were not deleted if kyuubi server restarted
    
    The root cause is that:
    com.google.common.cache::cleanup will not trigger removalListener action, 
we shall use `invalidateAll` instead.
    
    Testing:
    Nothing print for below code:
    ```
    import com.google.common.cache.{Cache, CacheBuilder, RemovalNotification}
    
    var removed = 0
    val cache: Cache[String, String] = CacheBuilder.newBuilder()
      .removalListener((notification: RemovalNotification[String, String]) => {
        removed += 1
        println("removed: " + removed)
      }).build()
    
    (0 until 1000).foreach { i =>
      cache.put(i.toString, i.toString)
    }
    
    cache.cleanup()
    ```
    
    Replacing `cache.cleanup()` with `cache.invalidateAll()`, the output is 
expected.
    
    ## Describe Your Solution ๐Ÿ”ง
    
    Please include a summary of the change and which issue is fixed. Please 
also include relevant motivation and context. List any dependencies that are 
required for this change.
    
    ## Types of changes :bookmark:
    
    - [ ] 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 ๐Ÿ“
    
    - [ ] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #6319 from turboFei/app_k8s_leak.
    
    Closes #6320
    
    ff2adfc60 [Wang, Fei] invalidate all
    
    Authored-by: Wang, Fei <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 26fe59d694108c12a4f4da24abcc2b6292a87deb)
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 738e7b23c..4cdc07b2e 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
@@ -265,7 +265,7 @@ class KubernetesApplicationOperation extends 
ApplicationOperation with Logging {
     enginePodInformers.clear()
 
     if (cleanupTerminatedAppInfoTrigger != null) {
-      cleanupTerminatedAppInfoTrigger.cleanUp()
+      cleanupTerminatedAppInfoTrigger.invalidateAll()
       cleanupTerminatedAppInfoTrigger = null
     }
 

Reply via email to