Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-27353

JIRA Sync Fails when detecting duplicate memberships

XMLWordPrintable

      Symptom

      When synchronising JIRA with LDAP, the synchronisation will fail when JIRA runs into a duplicate membership with the following in atlassian-jira.log:

      2012-02-29 06:24:30,407 QuartzWorker-0 ERROR ServiceRunner     [atlassian.crowd.directory.DbCachingDirectoryPoller] Error occurred while refreshing the cache for directory [ 10301 ].
      com.atlassian.crowd.embedded.ofbiz.db.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Membership][id,2537859][membershipType,GROUP_GROUP][lowerParentName,development-group][parentId,96939][childId,89522][childName,johndoe][lowerChildName,johndoe][directoryId,10301][parentName,Development-Group] (SQL Exception while executing the following:INSERT INTO public.cwd_membership (ID, parent_id, child_id, membership_type, group_type, parent_name, lower_parent_name, child_name, lower_child_name, directory_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "uk_mem_parent_child_type"))
      	at com.atlassian.crowd.embedded.ofbiz.db.OfBizHelper.createValue(OfBizHelper.java:167)
      	at com.atlassian.crowd.embedded.ofbiz.OfBizInternalMembershipDao.createMembership(OfBizInternalMembershipDao.java:113)
      	at com.atlassian.crowd.embedded.ofbiz.OfBizInternalMembershipDao.addGroupToGroup(OfBizInternalMembershipDao.java:120)
      	at com.atlassian.crowd.embedded.ofbiz.OfBizDelegatingMembershipDao.addGroupToGroup(OfBizDelegatingMembershipDao.java:87)
      	at com.atlassian.crowd.directory.AbstractInternalDirectory.addGroupToGroup(AbstractInternalDirectory.java:689)
      	at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.addGroupMembershipsForGroup(DbCachingRemoteChangeOperations.java:829)
      	at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.syncGroupMembersForGroup(DirectoryCacheImplUsingChangeOperations.java:142)
      	at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseMemberships(AbstractCacheRefresher.java:159)
      	at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:44)
      	at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseAll(UsnChangedCacheRefresher.java:223)
      	at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:619)
      	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.DirectoryPollerJob.execute(DirectoryPollerJob.java:34)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
      	at com.atlassian.multitenant.quartz.MultiTenantThreadPool$MultiTenantRunnable.run(MultiTenantThreadPool.java:72)
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
      Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:Membership][id,2537859][membershipType,GROUP_GROUP][lowerParentName,development-group][parentId,96939][childId,89522][childName,johndoe][lowerChildName,johndoe][directoryId,10301][parentName,Development-Group] (SQL Exception while executing the following:INSERT INTO public.cwd_membership (ID, parent_id, child_id, membership_type, group_type, parent_name, lower_parent_name, child_name, lower_child_name, directory_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "uk_mem_parent_child_type"))
      	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:133)
      	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:98)
      	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:64)
      	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:489)
      	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:469)
      	at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:80)
      	at com.atlassian.crowd.embedded.ofbiz.db.OfBizHelper.createValue(OfBizHelper.java:162)
      	... 16 more
      

      Cause

      This could be caused by casing changes in groups within the LDAP Directory - for example changing a group from space-marines to Space-Marines.

      This may be similar to CONF-22631. In that case, it was setup so that the synchronisation will complete even if Confluence ran into a duplicate membership. Instead of failing the sync, JIRA should log the duplicate and continue finishing the sync.

      Workaround

      1. Schedule a downtime window, as users will be unable to login during these changes.
      2. Log in as an administrator within the JIRA Internal Directory. If one does not exist, create it.
      3. Disable the problematic User Directory.
      4. Create a new User Directory within JIRA, using the same settings as the old one.
      5. Test the synchronisation and ensure that synchronisation completes successfully. If so, use this new directory.

      If you have a User Directory set up with the Read Only, with Local Groups permission settings you will no longer have the local groups set up in the database when the user directory is disabled. The project roles will not be affected.

      If you are using Microsoft AD, you can try to use the adsiedit.msc to change the SAMAccountName attribute for the users to lowercase in the LDAP.

              morzechowski Michal Orzechowski (Inactive)
              dchan David Chan
              Votes:
              13 Vote for this issue
              Watchers:
              34 Start watching this issue

                Created:
                Updated:
                Resolved: