Repository navigation
Conversation
The resync timer restarted whenever a watch was opened, and the watch timeout was int(resync_period). A fractional period such as 1.5 ended every stream after 1s, and an early watch close restarted the timer, so the periodic resync never ran. Keep a resync deadline set one period after each list, and set timeout_seconds to the time left, rounded up to whole seconds. Add fake-clock unit tests for integer, fractional and Decimal periods, early closes, failures and a restart.
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ilcm96 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
What this PR does / why we need it:
SharedInformerrestarts its resync timer whenever it reopens the watch, so a watch that keeps closing early postpones the resync forever.This happens behind a proxy or load balancer whose idle timeout is shorter than the gaps on a quiet watch: even with bookmarks, the API server sends one only about every 60s (and ~2s before
timeout_seconds). On kind behind an nginx TCP proxy,proxy_timeout 35s(the HAProxy timeout in the kubeadm HA guide) withresync_period=60made only the initial list in 130s. Withproxy_timeout 60s, the watch closed at ~60s or ~120s andresync_period=180never resynced.Fractional periods are probably rare, but they hit the same bug:
timeout_seconds=int(1.5)ends every watch after 1s, before the resync is due.This PR counts the resync deadline from the last list, so reconnects no longer restart it, and sets
timeout_secondsto the time left, rounded up.Which issue(s) this PR fixes:
None filed. The #2515 review asked whether the resync runs if the stream never ends;
timeout_secondscovers only integer periods.Special notes for your reviewer:
A fractional period is rounded up (1.5s resyncs every ~2s). Idle timeouts well above 60s are not affected, because bookmarks keep the watch open.
How I tested it:
resync_period=1.5listed every ~2s.test_informer.pyandtest_watch.pye2e: 7 passed, as on master.Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: