Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-9002

StackOverflowError when reading LDAP-backed users via REST API

    XMLWordPrintable

    Details

    • Steps to Reproduce:
      Hide

      1. Start an instance of standalone Keycloak;
      2. Configure an LDAP provider as WRITABLE with Sync Registrations on;
      3. Create a sample user in the Directory itself;
      4. Perform Synchronize all users;
      5. Using admin's admin-cli REST access, fetch /auth/admin/realms/master/users several times

      Show
      1. Start an instance of standalone Keycloak; 2. Configure an LDAP provider as WRITABLE with Sync Registrations on; 3. Create a sample user in the Directory itself; 4. Perform Synchronize all users; 5. Using admin's admin-cli REST access, fetch /auth/admin/realms/master/users several times
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      When Keycloak is configured to use a Writeable LDAP provider, calling GET /auth/admin/realms/master/users multiple times causes the cache to go a bit weird and eventually cause a StackOverflowError. The request then fails with HTTP 500. Clearing the cache temporarily helps.

      It seems that somewhere in the process of proxying, an already proxied entry is cached and proxied again in the org.keycloak.storage.ldap.LDAPStorageProvider, causing it to delegate to itself somewhere in the proxy chain.

      I've managed to suppress the error with this, but it doesn't seem like the right way to do it.

      The stacktrace is

      java.lang.StackOverflowError
      	at org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:58)
      	at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:51)
      	at com.sun.proxy.$Proxy62.find(Unknown Source)
      	at org.keycloak.models.jpa.JpaUserProvider.getUserById(JpaUserProvider.java:520)
      	at org.keycloak.storage.UserStorageManager.getUserById(UserStorageManager.java:369)
      	at org.keycloak.models.cache.infinispan.UserAdapter.getUserModel(UserAdapter.java:400)
      	at org.keycloak.models.cache.infinispan.DefaultLazyLoader.get(DefaultLazyLoader.java:42)
      	at org.keycloak.models.cache.infinispan.entities.CachedUser.getRequiredActions(CachedUser.java:112)
      	at org.keycloak.models.cache.infinispan.UserAdapter.getRequiredActions(UserAdapter.java:174)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.cache.infinispan.DefaultLazyLoader.get(DefaultLazyLoader.java:43)
      	at org.keycloak.models.cache.infinispan.entities.CachedUser.getRequiredActions(CachedUser.java:112)
      	at org.keycloak.models.cache.infinispan.UserAdapter.getRequiredActions(UserAdapter.java:174)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.utils.UserModelDelegate.getRequiredActions(UserModelDelegate.java:99)
      	at org.keycloak.models.cache.infinispan.DefaultLazyLoader.get(DefaultLazyLoader.java:43)
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mposolda Marek Posolda
                  Reporter:
                  sdokara Selvedin Dokara
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: