Repository navigation
Defer the revoked token reload until the cache topology has settled - #55414
Conversation
Closes keycloak#55413 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
32273ba to
9582f3c
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Critical races in the reload logic can allow revoked-token scans during topology reconciliation and clear the pending flag before merge recovery completes, preventing a retry.
3 open issues
What changed in this PR
This PR addresses the recovery-timing hypothesis behind #55413 by deferring persisted revoked-token reloads until the actionTokens cache appears settled, rather than starting them directly from cluster view notifications.
Changes:
- Adds lock-protected pending state and a topology listener, with settled-state checks and database scans running on the executor.
- Adds an exact-member-count wait before the split-brain test partitions the cluster.
| File | Description |
|---|---|
testsuite/model/src/test/java/org/keycloak/testsuite/model/infinispan/EmbeddedInfinispanSplitBrainTest.java |
Waits for the expected cluster size before splitting. |
model/infinispan/src/main/java/org/keycloak/models/sessions/infinispan/InfinispanSingleUseObjectProviderFactory.java |
Defers pending revocation reloads to cache topology notifications and adds listener cleanup. |
Review effort: Balanced
Relates to keycloak#55413 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.broker.KcSamlBrokerTest#testWithLinkedFederationProviderKeycloak CI - FIPS IT (strict) |
There was a problem hiding this comment.
🔵 Needs a closer look
Security-sensitive revoked-token recovery depends on unconfirmed notification-ordering and topology-convergence assumptions without a fallback retry, requiring affected CI runs and split-brain runtime validation.
No open issues 🎉
3 resolved since last review
Review effort: Balanced
There was a problem hiding this comment.
After the recent commits , The changes are stable and lgtm . Thanks @ahus1


Closes #55413
The cache manager view event is delivered before Infinispan has recovered the cache topology after a merge, so a reload triggered from it can write entries that are discarded when the partitions are reconciled.
Decisions and assumptions
@TopologyChangedlistener on theactionTokenscache runs the reload once the cache isAVAILABLE, the join is complete and no rehash is running. This keeps the existing rule that joins don't trigger a database scan, as only a merge or a member loss sets the flag.ReentrantLock, as the notification threads that set and read it may be virtual threads. The scan keepssynchronized, as it always runs on the executor's platform threads.