Skip to content

ReflectorRunnable returns the same objects again after watch-timeout and reconnect #1634

Closed
@synox

Description

@synox

Describe the bug
When using the Reconciler classes, I noticed that the same events are added to the queue again after 30-45 minutes.
I expected that the watcher would not add the the same events again to the queue.

** Client Version **
11.0.0

** Kubernetes Version **
v1.19.2 (minikube)

** Java Version **
Java 11

To Reproduce
Steps to reproduce the behavior:
Create a reconciler with a custom resource.

Expected behavior
Events should not be added to the queue twice.

Additional context
In order to keep the load low on the reconciler, we currently use a resyncPeriodInMillis of 4h. Now with the described behavior, we get a bigger load than expected.

In https://github.com/kubernetes-client/java/blob/master/util/src/main/java/io/kubernetes/client/informer/cache/ReflectorRunnable.java#L117 lastSyncResourceVersion is used to track which events have been processed. However in https://github.com/kubernetes-client/java/blob/master/util/src/main/java/io/kubernetes/client/informer/SharedInformerFactory.java#L259 the parameter is ignored and it always returns new events with the current state. The docs in the code should mention why.

It seems that in the watch api you can only reference resourceVersion that are very recent (like 5min). So once the timeout of the watch request happens after 35min, it can not start another watch with the same resourceVersion. Instead it loads the current state and returns those in the queue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions