GeezerVison is showing github.com — fix: avoid deadlock when changeNamespaces joins a populated shared informer by csviri · Pull Request #3655 · operator-framework/java-operator-sdk
Conversation
csviri
commented
Oct 22, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fabric8 replays an already populated informer's cache to a newly added
handler synchronously, on the registering thread. changeNamespaces
registered the handler on an informer starter thread while the event
source held its monitor waiting for that thread, so the replay blocked
on the monitor and deadlocked. Register the handlers on the calling
thread and only start the informers in parallel.
Fixes #3650
Summary by CodeRabbit
- Bug Fixes
- Improved namespace changes for active informers when cached events are replayed during handler registration.
- Newly added namespaces are watched, and events from them can be handled without the namespace change hanging.
- Informer startup now proceeds reliably when joining an already populated namespace, allowing replayed events to reach their handlers.
- Tests
- Added regression coverage confirming the namespace change completes within 10 seconds and delivers the replayed event.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 22, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2afc4ca9-428c-493d-bd92-b8425d9ba631
📥 Commits
-
Reviewing files that changed from the base of the PR and between e6bb598 and 72e7bbc.
📒 Files selected for processing: 2
-
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSourceNamespaceChangeTest.java
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
📝 Walkthrough
-
changeNamespaces now prepares namespace informer wrappers before executor tasks start them. A regression test covers synchronous cache replay during a namespace change and checks that the new namespace is watched and its event is handled.
Changes: Namespace changes
| Layer / File(s) |
Summary |
Informer startup and cache replay operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java, operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSourceNamespaceChangeTest.java |
changeNamespaces creates and registers namespace wrappers before submitting them to the executor. The test simulates synchronous replay of an existing resource during handler registration and checks that the namespace change completes, the namespace is watched, and the event handler receives an event. |
Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Medium
Merge Risk: ⚪ Minimal · up to 72e7b
-
The namespace-change deadlock path is covered by the new test, with no actionable merge-blocking risk identified.
Pre-merge checks: 4 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
Passed checks: 4 passed
-
| Check name |
Status |
Explanation |
| Description Check |
 |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
 |
The title clearly and concisely describes the primary change: preventing a deadlock when changeNamespaces joins a populated shared informer. |
| Linked Issues check |
 |
Issue #3650 requires namespace changes to complete when a new namespace joins a populated shared informer, while preserving event delivery and normal stop behavior. `InformerManager.changeNamespaces()… |
| Out of Scope Changes check |
 |
The changes remain within issue #3650. The production change only moves handler registration before parallel informer startup and updates related task logging. The test adds deadlock regression covera… |
Full details: Linked Issues check
-
Explanation
Issue #3650 requires namespace changes to complete when a new namespace joins a populated shared informer, while preserving event delivery and normal stop behavior. InformerManager.changeNamespaces() now creates each InformerWrapper and registers its handler on the calling thread before it waits for parallel informer startup. The regression test simulates synchronous cache replay, applies the namespace change with a timeout, verifies the new namespace and event delivery, and stops the event source.
Full details: Out of Scope Changes check
-
Explanation
The changes remain within issue #3650. The production change only moves handler registration before parallel informer startup and updates related task logging. The test adds deadlock regression coverage and refactors shared informer setup for that coverage. No unrelated change is demonstrated.
✨ Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
The focused fix removes the reported lock cycle, preserves lifecycle synchronization and parallel startup, and includes targeted regression coverage.
No open issues 🎉
What changed in this PR
Fixes #3650 by avoiding a deadlock when changeNamespaces() joins a populated shared informer in the core event-source runtime.
Changes:
- Registers handlers on the calling thread so synchronous cache replay can reenter the event-source monitor.
- Keeps informer startup parallel.
- Adds a regression test that simulates synchronous cache replay and verifies namespace changes complete and deliver an event.
| File |
Description |
| operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/ManagedInformerEventSourceNamespaceChangeTest.java |
Adds deadlock regression coverage and shared test helpers. |
| operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerManager.java |
Moves handler registration before parallel informer startup. |
Review effort: Balanced
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…former
Fabric8 replays an already populated informer's cache to a newly added
handler synchronously, on the registering thread. changeNamespaces
registered the handler on an informer starter thread while the event
source held its monitor waiting for that thread, so the replay blocked
on the monitor and deadlocked. Register the handlers on the calling
thread and only start the informers in parallel.
Fixes #3650
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
metacosm
Awaiting requested review from metacosm
xstefank
Awaiting requested review from xstefank
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|