Keycloak master crashes because of ORA-00001: unique constraint (KEYCLOAK.SIBLING_NAMES) violated

Hello everyone.

I’m running a keycloak 9.0.2 cluster on 2 debian 10.9
The shared database is hosted on Oracle 19.3 (CentOS 7.9.2009)

The realm master contains an Active Directory user federation with a group-ldap-mapper

It will synchronize the group periodically without problem for days and then it will output the following error logs :


Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:37:17,253 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Timer-2) ORA-00001: unique constraint (KEYCLOAK.SIBLING_NAMES) violated
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] 
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:37:17,254 ERROR [org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper] (Timer-2) Failed to sync group SOME-GROUP from LDAP: : org.keycloak.models.ModelDuplicateException: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:57)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:51)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at com.sun.proxy.$Proxy91.flush(Unknown Source)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.jpa.JpaRealmProvider.createGroup(JpaRealmProvider.java:571)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.cache.infinispan.RealmCacheSession.createGroup(RealmCacheSession.java:1007)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.cache.infinispan.RealmAdapter.createGroup(RealmAdapter.java:1356)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.RealmModel.createGroup(RealmModel.java:475)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.lambda$syncNonExistingGroup$1(GroupLDAPStorageMapper.java:219)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.syncNonExistingGroup(GroupLDAPStorageMapper.java:217)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.lambda$syncFlatGroupStructure$2(GroupLDAPStorageMapper.java:282)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.syncFlatGroupStructure(GroupLDAPStorageMapper.java:260)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.syncDataFromFederationProviderToKeycloak(GroupLDAPStorageMapper.java:187)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.LDAPStorageProviderFactory$1.run(LDAPStorageProviderFactory.java:490)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.LDAPStorageProviderFactory.syncMappers(LDAPStorageProviderFactory.java:480)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.LDAPStorageProviderFactory.syncSince(LDAPStorageProviderFactory.java:460)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager$3$1.call(UserStorageSyncManager.java:149)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager$3$1.call(UserStorageSyncManager.java:142)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.cluster.infinispan.InfinispanClusterProvider.executeIfNotExecuted(InfinispanClusterProvider.java:78)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager$3.run(UserStorageSyncManager.java:142)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager.syncChangedUsers(UserStorageSyncManager.java:132)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager$5.run(UserStorageSyncManager.java:215)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.timer.basic.BasicTimerProvider$1.run(BasicTimerProvider.java:51)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at java.util.TimerThread.mainLoop(Timer.java:555)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at java.util.TimerThread.run(Timer.java:505)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] Caused by: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1489)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1469)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at sun.reflect.GeneratedMethodAccessor628.invoke(Unknown Source)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at java.lang.reflect.Method.invoke(Method.java:498)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:49)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         ... 26 more
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:59)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3192)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3706)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:90)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:478)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:356)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1483)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         ... 31 more
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (KEYCLOAK.SIBLING_NAMES) violated
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] 
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:226)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:59)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:910)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1119)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1343)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OraclePreparedStatement.executeLargeUpdate(OraclePreparedStatement.java:3865)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3845)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1061)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         ... 39 more
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] Caused by: Error : 1, Position : 0, Sql = insert into KEYCLOAK_GROUP (NAME, PARENT_GROUP, REALM_ID, ID) values (:1 , :2 , :3 , :4 ), OriginalSql = insert into KEYCLOAK_GROUP (NAME, PARENT_GROUP, REALM_ID, ID) values (?, ?, ?, ?), Error Msg = ORA-00001: unique constraint (KEYCLOAK.SIBLING_NAMES) violated
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] 
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:498)
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one]         ... 55 more
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] 
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:37:17,260 INFO  [org.keycloak.storage.ldap.LDAPStorageProviderFactory] (Timer-2) Sync of federation mapper 'Groups' finished. Status: UserFederationSyncResult [ 0 imported groups, 1678 updated groups, 0 removed groups ]
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:37:17,261 INFO  [org.keycloak.storage.ldap.LDAPStorageProviderFactory] (Timer-2) Sync changed users from LDAP to local store: realm: master, federation provider: myDomain-ldap, last sync time: Mon Jun 28 18:27:17 CEST 2021
Jun 28 18:37:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:37:17,359 INFO  [org.keycloak.storage.ldap.LDAPStorageProviderFactory] (Timer-2) Sync changed users finished: 0 imported users, 0 updated users
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:47:17,078 INFO  [org.keycloak.storage.ldap.LDAPIdentityStoreRegistry] (Timer-2) Creating new LDAP Store for the LDAP storage provider: 'myDomain-ldap', LDAP Configuration: {pagination=[true], fullSyncPeriod=[86400], usersDn=[OU=MYOU,OU=Services,DC=myDomain,DC=net], connectionPooling=[true], cachePolicy=[DEFAULT], useKerberosForPasswordAuthentication=[false], importEnabled=[true], enabled=[true], usernameLDAPAttribute=[sAMAccountName], changedSyncPeriod=[600], bindDn=[CN=ApacheLDAP,OU=MYOU,OU=Services,DC=myDomain,DC=net], lastSync=[1624898837], vendor=[ad], uuidLDAPAttribute=[objectGUID], connectionUrl=[ldap://dc1.myDomain.net:389 ldap://dc2.myDomain.net:389], allowKerberosAuthentication=[false], syncRegistrations=[true], authType=[simple], debug=[false], searchScope=[2], useTruststoreSpi=[ldapsOnly], trustEmail=[false], priority=[0], userObjectClasses=[person, user], rdnLDAPAttribute=[cn], editMode=[READ_ONLY], validatePasswordPolicy=[false], batchSizeForSync=[1000]}, binaryAttributes: []
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:47:17,248 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Timer-2) SQL Error: 1, SQLState: 23000
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:47:17,248 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Timer-2) ORA-00001: unique constraint (KEYCLOAK.SIBLING_NAMES) violated
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] 
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:47:17,249 ERROR [org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper] (Timer-2) Failed to sync group FAGG_TST_Intune_Notification from LDAP: : org.keycloak.models.ModelDuplicateException: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.connections.jpa.PersistenceExceptionConverter.convert(PersistenceExceptionConverter.java:57)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:51)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at com.sun.proxy.$Proxy91.flush(Unknown Source)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.jpa.JpaRealmProvider.createGroup(JpaRealmProvider.java:571)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.cache.infinispan.RealmCacheSession.createGroup(RealmCacheSession.java:1007)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.cache.infinispan.RealmAdapter.createGroup(RealmAdapter.java:1356)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.RealmModel.createGroup(RealmModel.java:475)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.lambda$syncNonExistingGroup$1(GroupLDAPStorageMapper.java:219)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.syncNonExistingGroup(GroupLDAPStorageMapper.java:217)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.lambda$syncFlatGroupStructure$2(GroupLDAPStorageMapper.java:282)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.syncFlatGroupStructure(GroupLDAPStorageMapper.java:260)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.mappers.membership.group.GroupLDAPStorageMapper.syncDataFromFederationProviderToKeycloak(GroupLDAPStorageMapper.java:187)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.LDAPStorageProviderFactory$1.run(LDAPStorageProviderFactory.java:490)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.LDAPStorageProviderFactory.syncMappers(LDAPStorageProviderFactory.java:480)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.storage.ldap.LDAPStorageProviderFactory.syncSince(LDAPStorageProviderFactory.java:460)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager$3$1.call(UserStorageSyncManager.java:149)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager$3$1.call(UserStorageSyncManager.java:142)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.cluster.infinispan.InfinispanClusterProvider.executeIfNotExecuted(InfinispanClusterProvider.java:78)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager$3.run(UserStorageSyncManager.java:142)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.models.utils.KeycloakModelUtils.runJobInTransaction(KeycloakModelUtils.java:227)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager.syncChangedUsers(UserStorageSyncManager.java:132)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.services.managers.UserStorageSyncManager$5.run(UserStorageSyncManager.java:215)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.timer.basic.BasicTimerProvider$1.run(BasicTimerProvider.java:51)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at java.util.TimerThread.mainLoop(Timer.java:555)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at java.util.TimerThread.run(Timer.java:505)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] Caused by: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1489)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1469)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at sun.reflect.GeneratedMethodAccessor628.invoke(Unknown Source)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at java.lang.reflect.Method.invoke(Method.java:498)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.keycloak.connections.jpa.PersistenceExceptionConverter.invoke(PersistenceExceptionConverter.java:49)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         ... 26 more
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:59)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:178)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3192)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3706)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:90)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:604)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:478)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:356)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1483)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         ... 31 more
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (KEYCLOAK.SIBLING_NAMES) violated
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] 
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:226)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:59)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:910)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1119)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CPreparedStatement.executeInternal(T4CPreparedStatement.java:1343)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OraclePreparedStatement.executeLargeUpdate(OraclePreparedStatement.java:3865)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3845)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1061)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:175)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         ... 39 more
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] Caused by: Error : 1, Position : 0, Sql = insert into KEYCLOAK_GROUP (NAME, PARENT_GROUP, REALM_ID, ID) values (:1 , :2 , :3 , :4 ), OriginalSql = insert into KEYCLOAK_GROUP (NAME, PARENT_GROUP, REALM_ID, ID) values (?, ?, ?, ?), Error Msg = ORA-00001: unique constraint (KEYCLOAK.SIBLING_NAMES) violated
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] 
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:498)
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one]         ... 55 more
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] 
Jun 28 18:47:17 kcloak-master domain.sh[2198]: [Server:server-one] 18:47:17,252 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (Timer-2) SQL Error: 1, SQLState: 23000

While it is trying to synchronize, keycloak will be unusable and throw error 500.

When I restart the master, it goes away. It never happen when I manually synchronize the groups.

Any idea?

Thanks for your help.