Skip to content

fix: race condition on get when add received after informer cache read - alt 1#3238

Open
csviri wants to merge 9 commits intooperator-framework:mainfrom
csviri:rcaw-bug-alt1
Open

fix: race condition on get when add received after informer cache read - alt 1#3238
csviri wants to merge 9 commits intooperator-framework:mainfrom
csviri:rcaw-bug-alt1

Conversation

@csviri
Copy link
Collaborator

@csviri csviri commented Mar 17, 2026

No description provided.

csviri and others added 9 commits March 17, 2026 16:22
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
…he - alt 1

Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Copilot AI review requested due to automatic review settings March 17, 2026 20:49
@openshift-ci openshift-ci bot requested review from metacosm and xstefank March 17, 2026 20:49
@csviri csviri changed the title rcaw bug alt1 fix: extremely rare race condition when getting the resource from cache - alt 1 Mar 17, 2026
@csviri csviri changed the title fix: extremely rare race condition when getting the resource from cache - alt 1 fix: race condition on get when add received after informer cache read- alt 1 Mar 17, 2026
@csviri csviri changed the title fix: race condition on get when add received after informer cache read- alt 1 fix: race condition on get when add received after informer cache read - alt 1 Mar 17, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Addresses a suspected rare race condition in informer cache access by adjusting ManagedInformerEventSource#get to re-read the informer cache in a specific edge case, and strengthening an integration test reconciler to detect stale/incorrect secondary resource reads.

Changes:

  • Update ManagedInformerEventSource#get to handle the “temp cache present but obsolete + informer cache initially empty” scenario by re-reading the informer cache.
  • Extend the caching/filtering update test reconciler to perform two successive server-side applies and validate the cached secondary resource reflects the latest resource version.
  • Adjust debug logging around cache selection decisions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/cachingfilteringupdate/CachingFilteringUpdateReconciler.java Enhances the test reconciler to apply/update a secondary ConfigMap twice and assert the cache reflects the latest resource version.
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSource.java Implements an “informer cache re-read” fallback to mitigate an extremely rare ordering/race issue between temporary and informer caches, and updates related logs.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +55 to +56
if (!cachedCM
.orElseThrow()
Comment on lines +221 to +222
"Resource found in temp cache: {}, or older, in temporary cache. Found in informer cache"
+ " {}, for Resource ID: {}",
resourceID,
res.isEmpty());
if (res.isEmpty()) {
// re-reading resource from informer cache since an add even might have received
Comment on lines +211 to +215
if (res.isEmpty()) {
// re-reading resource from informer cache since an add even might have received
// after the first read.
return cache.get(resourceID);
} else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants