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

[REL] Searching all users from admin console is very slow

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: 12.0.1
    • Fix Version/s: 12.0.3
    • Component/s: Storage
    • Labels:
      None
    • Steps to Reproduce:
      Hide
      1. Make sure you have many users in your keycloak database
      2. Go to the "Users" section
      3. Click "View all users"

      Show
      Make sure you have many users in your keycloak database Go to the "Users" section Click "View all users"
    • Docs QE Status:
      NEW
    • QE Status:
      NEW

      Description

      Searching for all users is very slow. This looks like a regression since we never experienced such slowness on previous versions.

      I performed 3 thread dumps separated by 10 seconds each to understand what is happening. I attached them to the ticket.

      You can see thread "default task-3" is repeatedly  found in PasswordCredentialProvider:

      at java.net.SocketInputStream.socketRead0(Native Method)at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:457) at sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:68) at sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1095) at sun.security.ssl.SSLSocketImpl.access$200(SSLSocketImpl.java:72) at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:815) - locked <0x0000000728b96f68> (a sun.security.ssl.SSLSocketImpl$AppInputStream) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:161) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:128) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:113) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) at org.postgresql.core.PGStream.receiveChar(PGStream.java:441) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2057) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:323) - locked <0x0000000728b94c80> (a org.postgresql.core.v3.QueryExecutorImpl) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:473) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:393) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164) at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:114) at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:60) at org.hibernate.loader.Loader.getResultSet(Loader.java:2265) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:2028) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1990) at org.hibernate.loader.Loader.doQuery(Loader.java:949) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:351) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:321) at org.hibernate.loader.Loader.loadCollection(Loader.java:2501) at org.hibernate.loader.collection.plan.LegacyBatchingCollectionInitializerBuilder$LegacyBatchingCollectionInitializer.initialize(LegacyBatchingCollectionInitializerBuilder.java:88) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:692) at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:75) at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:2266) at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:585) at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:263) at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:581) at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:148) at org.hibernate.collection.internal.PersistentBag.iterator(PersistentBag.java:390) at java.util.Spliterators$IteratorSpliterator.estimateSize(Spliterators.java:1821) at java.util.Spliterator.getExactSizeIfKnown(Spliterator.java:408) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566) at org.keycloak.credential.PasswordCredentialProvider.onCache(PasswordCredentialProvider.java:285) at org.keycloak.credential.UserCredentialStoreManager.lambda$onCache$14(UserCredentialStoreManager.java:290) at org.keycloak.credential.UserCredentialStoreManager$$Lambda$2256/1775059307.accept(Unknown Source) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1235) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485) at org.keycloak.credential.UserCredentialStoreManager.onCache(UserCredentialStoreManager.java:290) at org.keycloak.models.cache.infinispan.UserCacheSession.onCache(UserCacheSession.java:367) at org.keycloak.models.cache.infinispan.UserCacheSession.cacheUser(UserCacheSession.java:358) at org.keycloak.models.cache.infinispan.UserCacheSession.getUserById(UserCacheSession.java:212) at org.keycloak.models.jpa.JpaUserProvider.lambda$searchForUserStream$6(JpaUserProvider.java:907) at org.keycloak.models.jpa.JpaUserProvider$$Lambda$2291/292556482.apply(Unknown Source)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mkanis Martin Kanis
              Reporter:
              reda_alaoui Réda Housni Alaoui
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: