javax.persistence.PersistenceException: org.hibernate.exception.LockAcquisitionException: could not execute statement: org.keycloak.models.ModelException: javax.persistence.PersistenceException: org.hibernate.exception.LockAcquisitionException: could not execute statement

jboss.org | 8 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    [keycloak-user] db deadlock in concurrence environment

    jboss.org | 8 months ago
    javax.persistence.PersistenceException: org.hibernate.exception.LockAcquisitionException: could not execute statement: org.keycloak.models.ModelException: javax.persistence.PersistenceException: org.hibernate.exception.LockAcquisitionException: could not execute statement

    Root Cause Analysis

    1. javax.persistence.PersistenceException

      org.hibernate.exception.LockAcquisitionException: could not execute statement: org.keycloak.models.ModelException: javax.persistence.PersistenceException: org.hibernate.exception.LockAcquisitionException: could not execute statement

      at org.keycloak.connections.jpa.PersistenceExceptionConverter.convert()
    2. org.keycloak.connections
      PersistenceExceptionConverter.invoke
      1. org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:44)
      2. org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:34)
      2 frames
    3. com.sun.proxy
      $Proxy147.flush
      1. com.sun.proxy.$Proxy147.flush(Unknown Source)
      1 frame
    4. org.keycloak.models
      KeycloakModelUtils.findUserByNameOrEmail
      1. org.keycloak.models.jpa.JpaUserProvider.removeUser(JpaUserProvider.java:117)
      2. org.keycloak.models.jpa.JpaUserProvider.removeUser(JpaUserProvider.java:97)
      3. org.keycloak.models.cache.infinispan.DefaultCacheUserProvider.removeUser(DefaultCacheUserProvider.java:283)
      4. org.keycloak.models.UserFederationManager.deleteInvalidUser(UserFederationManager.java:113)
      5. org.keycloak.models.UserFederationManager.validateAndProxyUser(UserFederationManager.java:135)
      6. org.keycloak.models.UserFederationManager.getUserByUsername(UserFederationManager.java:182)
      7. org.keycloak.models.utils.KeycloakModelUtils.findUserByNameOrEmail(KeycloakModelUtils.java:246)
      7 frames
    5. org.keycloak.authentication
      AuthenticationProcessor.authenticateOnly
      1. org.keycloak.authentication.authenticators.directgrant.ValidateUsername.authenticate(ValidateUsername.java:47)
      2. org.keycloak.authentication.DefaultAuthenticationFlow.processFlow(DefaultAuthenticationFlow.java:155)
      3. org.keycloak.authentication.AuthenticationProcessor.authenticateOnly(AuthenticationProcessor.java:776)
      3 frames
    6. org.keycloak.protocol
      TokenEndpoint.build
      1. org.keycloak.protocol.oidc.endpoints.TokenEndpoint.buildResourceOwnerPasswordCredentialsGrant(TokenEndpoint.java:369)
      2. org.keycloak.protocol.oidc.endpoints.TokenEndpoint.build(TokenEndpoint.java:110)
      2 frames
    7. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      3. java.lang.reflect.Method.invoke(Method.java:497)
      3 frames
    8. RESTEasy JAX-RS Implementation
      HttpServletDispatcher.service
      1. org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137)
      2. org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296)
      3. org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250)
      4. org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:140)
      5. org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:109)
      6. org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:135)
      7. org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:103)
      8. org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
      9. org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)
      10. org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
      11. org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
      12. org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
      12 frames
    9. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      1 frame
    10. Undertow Servlet
      FilterHandler$FilterChainImpl.doFilter
      1. io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)
      2. io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)
      2 frames
    11. org.keycloak.services
      KeycloakSessionServletFilter.doFilter
      1. org.keycloak.services.filters.KeycloakSessionServletFilter.doFilter(KeycloakSessionServletFilter.java:61)
      1 frame
    12. Undertow Servlet
      ServletDispatchingHandler.handleRequest
      1. io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
      2. io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
      3. io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
      4. io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
      5. io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      5 frames
    13. WildFly: Undertow
      SecurityContextAssociationHandler.handleRequest
      1. org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      1 frame
    14. Undertow Core
      PredicateHandler.handleRequest
      1. io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      1 frame
    15. Undertow Servlet
      ServletAuthenticationCallHandler.handleRequest
      1. io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      2. io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
      2 frames
    16. Undertow Core
      AbstractConfidentialityHandler.handleRequest
      1. io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      2. io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
      2 frames
    17. Undertow Servlet
      ServletConfidentialityConstraintHandler.handleRequest
      1. io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      1 frame
    18. Undertow Core
      AuthenticationMechanismsHandler.handleRequest
      1. io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
      1 frame
    19. Undertow Servlet
      CachedAuthenticatedSessionHandler.handleRequest
      1. io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
      1 frame
    20. Undertow Core
      PredicateHandler.handleRequest
      1. io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
      2. io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
      3. io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      3 frames
    21. WildFly: Undertow
      JACCContextIdHandler.handleRequest
      1. org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      1 frame
    22. Undertow Core
      PredicateHandler.handleRequest
      1. io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      2. io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      2 frames
    23. Undertow Servlet
      ServletInitialHandler$1.handleRequest
      1. io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
      2. io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
      3. io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
      4. io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
      4 frames
    24. Undertow Core
      HttpServerExchange$1.run
      1. io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
      2. io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
      2 frames
    25. Java RT
      ThreadPoolExecutor$Worker.run
      1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      2 frames