Commit Graph

4 Commits

Author SHA1 Message Date
Antonio Ojea
374e3638f2 workqueue unit tests to assert collapsing behaviors
Change-Id: If4bf54c3af603c17de49055960f9a76e7d38aab3

Kubernetes-commit: 8a31bb6786c2d3600bade49de7a64a026802bd6d
2023-09-21 10:48:01 +00:00
John Howard
eb364c77d8 workqueue: fix leak in queue preventing objects from being GCed
See https://github.com/grpc/grpc-go/issues/4758 for a real world example
of this leaking 2gb+ of data.

Basically, when we do `q.queue[1:]` we are just repositioning the slice.
The underlying array is still active, which contains the object formerly
known as `q.queue[0]`. Because its referencing this object, it will not
be GCed. The only thing that will trigger it to free is eventually when
we add enough to the queue that we allocate a whole new array.

Instead, we should explicitly clear out the old space when we remove it
from the queue. This ensures the object can be GCed, assuming the users'
application doesn't reference it anymore.

Kubernetes-commit: 2a34801168dc1c70ba25b1d4200b534bf515cbc2
2021-09-14 15:51:09 -07:00
Alexander Constantinescu
22aa998def [queue] Implement ShutDownWithDrain allowing the queue to drain when shutting down
Signed-off-by: Alexander Constantinescu <aconstan@redhat.com>

Kubernetes-commit: 5b740f430e0a4892e9db3a1fea9f349a06267755
2021-05-12 02:26:22 +02:00
Kubernetes Publisher
b766ef93a4 published by bot
(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is a2b65f03bf83013d1af05c99b7aa22049ca63de3
2017-01-31 15:19:42 +00:00