Files
client-go/tools
Odin Ugedal 58381003a1 client-go/cache: fix missing delete event on replace
This fixes a race condition when a "short lived" object
is created and the create event is still present on the queue
when a relist replaces the state. Previously that would lead in the
object being leaked.

The way this could happen is roughly;

1. new Object is added O, agent gets CREATED event for it
2. watch is terminated, and the agent runs a new list, L
3. CREATE event for O is still on the queue to be processed.
4. informer replaces the old data in store with L, and O is not in L
  - Since O is not in the store, and not in the list L, no DELETED event
    is queued
5. CREATE event for O is still on the queue to be processed.
6. CREATE event for O is processed
7. O is <leaked>; its present in the cache but not in k8s.

With this patch, on step 4. above it would create a DELETED event
ensuring that the object will be removed.

Signed-off-by: Odin Ugedal <ougedal@palantir.com>
Signed-off-by: Odin Ugedal <odin@uged.al>

Kubernetes-commit: bdc4a22309fc51f824aca41f11ee4466758ea9b0
2023-02-08 14:57:23 +00:00
..
2022-07-19 20:54:13 -04:00
2022-07-19 20:54:13 -04:00
2022-02-11 14:50:19 -05:00
2022-07-19 20:54:13 -04:00
2022-07-19 20:54:13 -04:00
2022-07-19 20:54:13 -04:00
2021-01-11 08:36:27 +00:00
2022-07-19 20:54:13 -04:00