Database deadlock on LDAP user since in RH-SSO

Solution Unverified - Updated -


  • Sync fails and database deadlocks with exception:

    KC-SERVICES0062: Error occurred during sync of changed users: javax.persistence.OptimisticLockException: org.hibernate.exception.LockAcquisitionException: could not execute query
        at org.hibernate.internal.ExceptionConverterImpl.wrapLockException(
        at org.hibernate.internal.ExceptionConverterImpl.convert(
        at org.hibernate.internal.ExceptionConverterImpl.convert(
        at org.hibernate.query.internal.AbstractProducedQuery.list(
        at org.hibernate.query.Query.getResultList(
        at org.keycloak.models.jpa.UserAdapter.getRoleMappings(
        at org.keycloak.models.jpa.UserAdapter.hasRole(
        at org.keycloak.models.jpa.UserAdapter.grantRole(
        at org.keycloak.models.utils.DefaultRoles.addDefaultRoles(
        at org.keycloak.models.jpa.JpaUserProvider.addUser(
        at org.keycloak.models.jpa.JpaUserProvider.addUser(


  • Red Hat Single Sign-On (RH-SSO)
    • 7.3
  • Microsoft SQL Server
  • Java Database Connectivity (JDBC)
  • Lightweight Directory Access Protocol (LDAP) or Microsoft Active Directory (AD)
  • User sync

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In