Skip to content

When building a controller with DefaultControllerBuilder and overriding the queue with withWorkQueue, there will be a thread leakage issue. #3738

Closed
@yuzp1996

Description

@yuzp1996
Contributor

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:

  1. Create a controller with DefaultControllerBuilder and override the queue with a newly created queue using withWorkQueue.
  2. Shut down the controller and restart it multiple times.
  3. Check the threads and you will find there are many timed_waiting threads.
image
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

changed the title [-]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[/+] on Oct 12, 2024
changed the title [-]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.[/+] on Oct 12, 2024

3 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @yuzp1996

        Issue actions

          When building a controller with `DefaultControllerBuilder` and overriding the queue with `withWorkQueue`, there will be a thread leakage issue. · Issue #3738 · kubernetes-client/java