Closed
Description
Describe the bug
When I utilize DefaultControllerBuilder
to construct my controller and override the queue by creating a new one using withWorkQueue
, the default queue will not be shut down even after I shut down the controller.
Client Version
11.0.1
Kubernetes Version
1.21
Java Version
Java 11
To Reproduce
Steps to reproduce the behavior:
- Create a controller with
DefaultControllerBuilder
and override the queue with a newly created queue usingwithWorkQueue
. - Shut down the controller and restart it multiple times.
- Check the threads and you will find there are many
timed_waiting
threads.

stackTrace:
java.lang.Thread.State: TIMED_WAITING (parking)
at jdk.internal.misc.Unsafe.park(java.base@11.0.18/Native Method)
- parking to wait for <0x000000056bd50a58> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.18/LockSupport.java:234)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(java.base@11.0.18/AbstractQueuedSynchronizer.java:2123)
at java.util.concurrent.LinkedBlockingQueue.poll(java.base@11.0.18/LinkedBlockingQueue.java:458)
at io.kubernetes.client.extended.workqueue.DefaultDelayingQueue.waitingLoop(DefaultDelayingQueue.java:93)
at io.kubernetes.client.extended.workqueue.DefaultDelayingQueue$$Lambda$347/0x0000000800a1bc40.run(Unknown Source)
at java.util.concurrent.Executors$RunnableAdapter.call(java.base@11.0.18/Executors.java:515)
at java.util.concurrent.FutureTask.run(java.base@11.0.18/FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.18/ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.18/ThreadPoolExecutor.java:628)
at java.lang.Thread.run(java.base@11.0.18/Thread.java:829)
Expected behavior
When the controller is shut down, the queue should also be shut down.
Activity
[-]When build controller with DefaultControllerBuilder and override queue with `withWorkQueue` there will be a thread leakage[/-][+]When build controller with `DefaultControllerBuilder` and override queue with `withWorkQueue` there will be a thread leakage[/+][-]When build controller with `DefaultControllerBuilder` and override queue with `withWorkQueue` there will be a thread leakage[/-][+]When building a controller with `DefaultControllerBuilder` and overriding the queue with `withWorkQueue`, there will be a thread leakage issue.[/+]When override workQueue for the controller should shutdown the origin…
fix thread-leakage and releated issue: kubernetes-client#3738
fix thread-leakage and releated issue: kubernetes-client#3738
fix thread-leakage and releated issue: kubernetes-client#3738
fix thread-leakage and releated issue: kubernetes-client#3738
Fix thread-leakage and releated
Fix thread leakage when override controller queue with `withQueue`
Fix thread leakage when override controller queue with `withQueue`
withQueue
alauda/java#1Fix thread leakage when override controller queue with `withQueue`
Fix thread leakage when override controller queue with `withQueue`
Fix thread leakage when override controller queue with `withQueue`
3 remaining items