Uploaded image for project: 'Red Hat build of Keycloak'
  1. Red Hat build of Keycloak
  2. RHBK-1861

NullPointerException on RealmCacheSession when upgrading Keycloak 23.0.4 to 24.0.2 [GHI#28865]

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False

      Before reporting an issue

      [x] I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

      Area

      infinispan

      Describe the bug

      Encountered a NullPointerException while performing configuration validation after upgrading to the latest version.

      After upgrading Keycloak to 24.0.2, an error occurred while deleting ClientScopes with multiple replicas of Keycloak.
      However, the deletion was successfully completed with only one replica(pod).

      This wasn't happening with Keycloak 23.0.4.

      ```
      2024-04-15 09:22:19,434 ERROR [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-3) Uncaught server error: java.lang.NullPointerException
      at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
      at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1707)
      at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
      at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
      at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
      at org.keycloak.models.cache.infinispan.RealmCacheSession.getClientScopesStream(RealmCacheSession.java:1353)
      at org.keycloak.models.cache.infinispan.RealmAdapter.getClientScopesStream(RealmAdapter.java:1486)
      at org.keycloak.services.resources.admin.ClientScopeResource.deleteClientScope(ClientScopeResource.java:154)
      at org.keycloak.services.resources.admin.ClientScopeResource$quarkusrestinvoker$deleteClientScope_b6021911236efd787af232d356a308f338ee6a34.invoke(Unknown Source)
      at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
      at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:141)
      at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:147)
      at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:582)
      at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
      at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
      at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
      at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      at java.base/java.lang.Thread.run(Thread.java:840)
      ```

      Version

      24.0.2

      Regression

      [ ] The issue is a regression

      Expected behavior

      ClientScope deletion works with more than one replica

      Actual behavior

      NullPointerException occurred when using multiple replicas

      How to Reproduce?

      This problem will occur when Keycloak version is upgraded from 23.0.4 to 24.0.2 and the number of keycloak replica is set to two or more.

      Anything else?

      No response

            Unassigned Unassigned
            pvlha Pavel Vlha
            Keycloak SRE
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: