Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-22631

Null pointer when detecting duplicate memberships while synchronising

      If Confluence detects a duplicate user membership while synchronising, instead of logging the list of records that it failed to synchronise, Confluence will instead throw a null pointer exception and abort the synchronisation attempt.

      2011-05-26 20:38:36,911 ERROR [QuartzScheduler_Worker-5] [sf.hibernate.util.JDBCExceptionReporter] logExceptions Duplicate entry '26149112-26117979' for key 'cwd_unique_user_membership'
      2011-05-26 20:38:36,912 ERROR [QuartzScheduler_Worker-5] [sf.hibernate.impl.SessionImpl] execute Could not synchronize database state with session
      2011-05-26 20:38:36,913 WARN [QuartzScheduler_Worker-5] [persistence.hibernate.batch.AbstractBatchProcessor] processBatch batch failed falling back to individual processing
      java.lang.RuntimeException: could not flush session
      	at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.flushSession(Hibernate2BatchProcessor.java:169)
      	at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.commitTransaction(Hibernate2BatchProcessor.java:107)
      	at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.afterProcessBatch(Hibernate2BatchProcessor.java:42)
      	at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:160)
      	at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:132)
      	at com.atlassian.crowd.embedded.hibernate2.HibernateMembershipDao.addAll(HibernateMembershipDao.java:181)
      	at com.atlassian.crowd.embedded.hibernate2.HibernateMembershipDao.addAllUsersToGroup(HibernateMembershipDao.java:45)
      	at com.atlassian.confluence.user.crowd.CachedCrowdMembershipDao.addAllUsersToGroup(CachedCrowdMembershipDao.java:81)
      	at com.atlassian.crowd.directory.CachingDirectory.addAllUsersToGroup(CachingDirectory.java:125)
      	at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.addUserMembershipsForGroup(DbCachingRemoteChangeOperations.java:734)
      	at sun.reflect.GeneratedMethodAccessor348.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      	at com.atlassian.crowd.directory.$Proxy627.addUserMembershipsForGroup(Unknown Source)
      	at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.syncUserMembershipsForGroup(DirectoryCacheImplUsingChangeOperations.java:116)
      	at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseMembershipsForGroup(AbstractCacheRefresher.java:126)
      	at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseMemberships(AbstractCacheRefresher.java:63)
      	at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:37)
      	at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:645)
      	at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:63)
      	at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50)
      	at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobBean.executeInternal(DirectoryPollerJobBean.java:29)
      	at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
      	at com.atlassian.confluence.schedule.quartz.ConfluenceQuartzThreadPool$1.run(ConfluenceQuartzThreadPool.java:14)
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      Caused by: net.sf.hibernate.exception.ConstraintViolationException: could not insert: [com.atlassian.crowd.embedded.hibernate2.HibernateMembership#26191886]
      	at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:73)
      	at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
      	at net.sf.hibernate.persister.AbstractEntityPersister.convert(AbstractEntityPersister.java:1331)
      	at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:472)
      	at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436)
      	at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
      	at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2447)
      	at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2433)
      	at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2390)
      	at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2259)
      	at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.flushSession(Hibernate2BatchProcessor.java:165)
      	... 31 more
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '26149112-26117979' for key 'cwd_unique_user_membership'
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
      	at com.mysql.jdbc.Util.getInstance(Util.java:381)
      	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1038)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)
      	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)
      	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
      	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
      	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2693)
      	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2102)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2395)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2313)
      	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2298)
      	at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
      	at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
      	at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:462)
      	... 38 more
      
      2011-05-26 20:38:36,940 ERROR [QuartzScheduler_Worker-5] [crowd.embedded.hibernate2.HibernateMembershipDao] addAllUsersToGroup The following group memberships could not be processed:
      2011-05-26 20:38:36,941 INFO [QuartzScheduler_Worker-5] [atlassian.crowd.directory.DbCachingRemoteChangeOperations] addUserMembershipsForGroup added [ 0 ] user members to [ parent-group ] in [ 76ms ]
      2011-05-26 20:38:36,942 INFO [QuartzScheduler_Worker-5] [atlassian.crowd.directory.DbCachingRemoteDirectory] synchroniseCache synchronisation complete in [ 15801ms ]
      2011-05-26 20:38:36,944 ERROR [QuartzScheduler_Worker-5] [atlassian.crowd.directory.DbCachingDirectoryPoller] pollChanges Error occurred while refreshing the cache for directory [ 21856257 ].
      java.lang.NullPointerException
      	at com.atlassian.crowd.embedded.hibernate2.HibernateMembershipDao.addAllUsersToGroup(HibernateMembershipDao.java:51)
      	at com.atlassian.confluence.user.crowd.CachedCrowdMembershipDao.addAllUsersToGroup(CachedCrowdMembershipDao.java:81)
      	at com.atlassian.crowd.directory.CachingDirectory.addAllUsersToGroup(CachingDirectory.java:125)
      	at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.addUserMembershipsForGroup(DbCachingRemoteChangeOperations.java:734)
      	at sun.reflect.GeneratedMethodAccessor348.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      	at com.atlassian.crowd.directory.$Proxy627.addUserMembershipsForGroup(Unknown Source)
      	at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.syncUserMembershipsForGroup(DirectoryCacheImplUsingChangeOperations.java:116)
      	at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseMembershipsForGroup(AbstractCacheRefresher.java:126)
      	at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseMemberships(AbstractCacheRefresher.java:63)
      	at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:37)
      	at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:645)
      	at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:63)
      	at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50)
      	at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobBean.executeInternal(DirectoryPollerJobBean.java:29)
      	at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
      	at com.atlassian.confluence.schedule.quartz.ConfluenceQuartzThreadPool$1.run(ConfluenceQuartzThreadPool.java:14)
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      

      Known issues

      The fix for this issue adds further diagnostics that will (in much more limited circumstances) trigger more null pointer exceptions that will abort synchronisation. These are described in CONF-23102, and fixed in Confluence 3.5.12 or higher. For this reason, the recommended fix is to upgrade to 3.5.12 or higher.

      Patch

      Attached to CONF-22342 is an updated version of atlassian-embedded-crowd-hibernate2 jar, to patch this issue. When patched, transactions will now correctly rollback, and log the records that were in error.

      It is known to work in Confluence 3.5.4 and 3.5.5, and might work in earlier versions, but these have not been tested, nor should they require it unless they are patching CONF-22342. It is not needed in Confluence 3.5.6, as that version already contains this fix.

      Installation

      To install the patch:

      1. Stop Confluence
      2. Move the old atlassian-embedded-crowd-hibernate2 jar out of <confluence install dir>/confluence/WEB-INF/lib
      3. Copy the new jar into the same directory
      4. Start Confluence

            [CONFSERVER-22631] Null pointer when detecting duplicate memberships while synchronising

            pranjal.shukla@honeywell.com Do not attach your logs to CONF issues, as they are public. Add them to the CSP support case, and we'll take it from there.

            Richard Atkins added a comment - pranjal.shukla@honeywell.com Do not attach your logs to CONF issues, as they are public. Add them to the CSP support case, and we'll take it from there.

            Hi richatkins
            I already have a ticket with the support. I do have complete synch logs with me, do you want me to attach the same on his ticket?

            Pranjal Shukla added a comment - Hi richatkins I already have a ticket with the support. I do have complete synch logs with me, do you want me to attach the same on his ticket?

            pranjal.shukla@honeywell.com I'll need to see some logs for the problem you're experiencing to know what's happening, and if this issue is the root cause. Please raise a support request, and we'll help you there.

            Richard Atkins added a comment - pranjal.shukla@honeywell.com I'll need to see some logs for the problem you're experiencing to know what's happening, and if this issue is the root cause. Please raise a support request, and we'll help you there.

            Can somebody re-open this bug? I still see this in 4.2.1 version of Confluence.

            Pranjal Shukla added a comment - Can somebody re-open this bug? I still see this in 4.2.1 version of Confluence.

            Hi There, i still face this issue in Confluence 4.2.1. What to do.

            Pranjal Shukla added a comment - Hi There, i still face this issue in Confluence 4.2.1. What to do.

            Hi Alex, thanks for noticing! I've fixed that typo now.

            Richard Atkins added a comment - Hi Alex, thanks for noticing! I've fixed that typo now.

            AlexH added a comment -

            Typo in the description references the wrong JIRA. Here is the corrected phrase:


            The fix for this issue adds further diagnostics that will (in much more limited circumstances) trigger more null pointer exceptions that will abort synchronisation. These are described in https://jira.atlassian.com/browse/CONF-23102, and fixed in Confluence 3.5.12 or higher. For this reason, the recommended fix is to upgrade to 3.5.12 or higher.

            AlexH added a comment - Typo in the description references the wrong JIRA. Here is the corrected phrase: The fix for this issue adds further diagnostics that will (in much more limited circumstances) trigger more null pointer exceptions that will abort synchronisation. These are described in https://jira.atlassian.com/browse/CONF-23102 , and fixed in Confluence 3.5.12 or higher. For this reason, the recommended fix is to upgrade to 3.5.12 or higher.

            Krishna,

            The constraint error you are getting indicates that your LDAP system has two users with the same lower case usernames. Confluence does not support users that differ only in the case of their usernames, nor does it support users with distinct LDAP Distinguished Names (DNs), but the same usernames. You'll need to exclude one of those users from the scope of the users Confluence can see, or fix the usernames to be unique. If you need help with that, please raise a support case.

            Sheppe,

            The issue you were seeing that prevents the sync from completing should now be resolved, and will be available in 3.5.12. The cause of the issue - duplicate memberships - would need to be resolved in your LDAP system, or through excluding the conflicting part of the LDAP tree from the data Confluence will sync via the Confluence User Directories admin pages. Since I'm not aware of any configuration that would lead to duplicate memberships without already having had duplicate user or group errors, we'll need to investigate further to find out what the root cause might be. Please attach that info to the support case that hercules linked you here from, or a new support case.

            Richard Atkins added a comment - Krishna, The constraint error you are getting indicates that your LDAP system has two users with the same lower case usernames. Confluence does not support users that differ only in the case of their usernames, nor does it support users with distinct LDAP Distinguished Names (DNs), but the same usernames. You'll need to exclude one of those users from the scope of the users Confluence can see, or fix the usernames to be unique. If you need help with that, please raise a support case. Sheppe, The issue you were seeing that prevents the sync from completing should now be resolved, and will be available in 3.5.12. The cause of the issue - duplicate memberships - would need to be resolved in your LDAP system, or through excluding the conflicting part of the LDAP tree from the data Confluence will sync via the Confluence User Directories admin pages. Since I'm not aware of any configuration that would lead to duplicate memberships without already having had duplicate user or group errors, we'll need to investigate further to find out what the root cause might be. Please attach that info to the support case that hercules linked you here from, or a new support case.

            I am also facing the same problem. I started out fresh with a new database dump. Restarted confluence(3.5.9). Logged in as admin and tried to migrate users to ldap for authentication. Consistently get the errors on the same users every time.

            2011-08-24 18:28:13,091 WARN [QuartzScheduler_Worker-7] [com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor] processBatch batch failed falling back to individual processing
            java.lang.RuntimeException: could not flush session
            at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.flushSession(Hibernate2BatchProcessor.java:169)
            at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.commitTransaction(Hibernate2BatchProcessor.java:107)
            at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.afterProcessBatch(Hibernate2BatchProcessor.java:42)
            at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:160)
            at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:132)
            at com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.addAll(HibernateUserDao.java:188)
            at com.atlassian.confluence.user.crowd.CachedCrowdUserDao.addAll(CachedCrowdUserDao.java:148)
            at com.atlassian.crowd.directory.CachingDirectory.addAllUsers(CachingDirectory.java:96)
            at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.addUsers(DbCachingRemoteChangeOperations.java:168)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
            at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at com.atlassian.crowd.directory.$Proxy685.addUsers(Unknown Source)
            at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.addOrUpdateCachedUsers(DirectoryCacheImplUsingChangeOperations.java:56)
            at com.atlassian.crowd.directory.ldap.cache.RemoteDirectoryCacheRefresher.synchroniseAllUsers(RemoteDirectoryCacheRefresher.java:69)
            at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:33)
            at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:645)
            at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:63)
            at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50)
            at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobBean.executeInternal(DirectoryPollerJobBean.java:29)
            at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
            at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
            at com.atlassian.confluence.schedule.quartz.ConfluenceQuartzThreadPool$1.run(ConfluenceQuartzThreadPool.java:14)
            at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
            Caused by: net.sf.hibernate.exception.ConstraintViolationException: could not insert: com.atlassian.crowd.model.user.InternalUser#123404289
            at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:62)
            at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
            at net.sf.hibernate.persister.AbstractEntityPersister.convert(AbstractEntityPersister.java:1331)
            at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:472)
            at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436)
            at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37)
            at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2447)
            at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2433)
            at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2390)
            at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2259)
            at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.flushSession(Hibernate2BatchProcessor.java:165)
            ... 30 more
            Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "cwd_user_name_dir_id"
            at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
            at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
            at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
            at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
            at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
            at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
            at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
            at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22)
            at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:462)

            Thanks much for your help in advance.

            -Krishna

            Krishna Kamity added a comment - I am also facing the same problem. I started out fresh with a new database dump. Restarted confluence(3.5.9). Logged in as admin and tried to migrate users to ldap for authentication. Consistently get the errors on the same users every time. 2011-08-24 18:28:13,091 WARN [QuartzScheduler_Worker-7] [com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor] processBatch batch failed falling back to individual processing java.lang.RuntimeException: could not flush session at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.flushSession(Hibernate2BatchProcessor.java:169) at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.commitTransaction(Hibernate2BatchProcessor.java:107) at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.afterProcessBatch(Hibernate2BatchProcessor.java:42) at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.processBatch(AbstractBatchProcessor.java:160) at com.atlassian.crowd.util.persistence.hibernate.batch.AbstractBatchProcessor.execute(AbstractBatchProcessor.java:132) at com.atlassian.crowd.embedded.hibernate2.HibernateUserDao.addAll(HibernateUserDao.java:188) at com.atlassian.confluence.user.crowd.CachedCrowdUserDao.addAll(CachedCrowdUserDao.java:148) at com.atlassian.crowd.directory.CachingDirectory.addAllUsers(CachingDirectory.java:96) at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.addUsers(DbCachingRemoteChangeOperations.java:168) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.atlassian.crowd.directory.$Proxy685.addUsers(Unknown Source) at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.addOrUpdateCachedUsers(DirectoryCacheImplUsingChangeOperations.java:56) at com.atlassian.crowd.directory.ldap.cache.RemoteDirectoryCacheRefresher.synchroniseAllUsers(RemoteDirectoryCacheRefresher.java:69) at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:33) at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:645) at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:63) at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50) at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJobBean.executeInternal(DirectoryPollerJobBean.java:29) at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86) at org.quartz.core.JobRunShell.run(JobRunShell.java:199) at com.atlassian.confluence.schedule.quartz.ConfluenceQuartzThreadPool$1.run(ConfluenceQuartzThreadPool.java:14) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) Caused by: net.sf.hibernate.exception.ConstraintViolationException: could not insert: com.atlassian.crowd.model.user.InternalUser#123404289 at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:62) at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29) at net.sf.hibernate.persister.AbstractEntityPersister.convert(AbstractEntityPersister.java:1331) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:472) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:436) at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:37) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2447) at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2433) at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2390) at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2259) at com.atlassian.crowd.embedded.hibernate2.batch.Hibernate2BatchProcessor.flushSession(Hibernate2BatchProcessor.java:165) ... 30 more Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "cwd_user_name_dir_id" at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105) at net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:22) at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:462) Thanks much for your help in advance. -Krishna

            Hi Richard,

            I can tell you that the situation you describe is not what's happening. The sync fails in the exact same place/ group every time, and on a group from which no users would be logging in. Also, I can consistently replicate the issue, and have, during outages in which no users are attempting to log in. The error indicates that your software does not seem to be gracefully trapping a database error that is being thrown when the system attempts to insert a duplicate record into the table that you are using to store user information.

            Thanks for your continued efforts in resolving this issue ASAP.

            -Sheppe

            Sheppe Pharis added a comment - Hi Richard, I can tell you that the situation you describe is not what's happening. The sync fails in the exact same place/ group every time, and on a group from which no users would be logging in. Also, I can consistently replicate the issue, and have, during outages in which no users are attempting to log in. The error indicates that your software does not seem to be gracefully trapping a database error that is being thrown when the system attempts to insert a duplicate record into the table that you are using to store user information. Thanks for your continued efforts in resolving this issue ASAP. -Sheppe

              richatkins Richard Atkins
              richatkins Richard Atkins
              Affected customers:
              0 This affects my team
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 2h
                  2h
                  Remaining:
                  Remaining Estimate - 2h
                  2h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified