Skip to content

fix: invalidate stale informer retries on stop and restart - #3052

Merged
kubernetes-prow[bot] merged 2 commits into
kubernetes-client:mainfrom
davidgamero:fix/informer-lifecycle-hardening
Sep 9, 2026
Merged

fix: invalidate stale informer retries on stop and restart#3052
kubernetes-prow[bot] merged 2 commits into
kubernetes-client:mainfrom
davidgamero:fix/informer-lifecycle-hardening

Conversation

@davidgamero

Copy link
Copy Markdown
Contributor

build on #3034

add preventative check to cover the following case:

  1. retryable call A fails, starting wait
  2. call stop() for informer
  3. call start() for informer, opening watch B
  4. A's pending retry finishes wait, checks stopped === false and retries, opening a duplicate watch A
  • prevent pending informer retries from surviving a stop/restart cycle and creating duplicate watches
  • discards LIST results that arrive after shutdown, preventing cache updates and unwanted reconnections
  • use a generation counter to ignore stale callbacks and abort watch connections that complete too late
  • add tests covering the race

ai disclosure: opencode + gpt6

@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 9, 2026
@kubernetes-prow kubernetes-prow Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 9, 2026
@davidgamero
davidgamero marked this pull request as ready for review September 9, 2026 14:53
@kubernetes-prow kubernetes-prow Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 9, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from cjihrig September 9, 2026 14:53

@cjihrig cjihrig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, but LGTM

/lgtm

Comment thread src/cache_test.ts
deepStrictEqual(errors, [error]);
});

function deferred<T = void>() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can Promise.withResolvers() be used here?

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 9, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cjihrig, davidgamero

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [cjihrig,davidgamero]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow
kubernetes-prow Bot merged commit 791f389 into kubernetes-client:main Sep 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants