Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-5429

multiple results in cwd_synchronisation_status table cause directory synchronisation failed

      Issue Summary

      Synchronization sometimes failed, in the logs we can see the error failed at the findActiveInne method. The following errors appear in the logs if there are more than one records returns in cwd_synchronisation_status table in the database.

      Steps to Reproduce

      N/A

      Expected Results

      synchronization successful without any problem

      Actual Results

      The below exception is thrown in the atlassian-crowd.log file:

      org.hibernate.NonUniqueResultException: query did not return a unique result: 2
      at org.hibernate.query.internal.AbstractProducedQuery.uniqueElement(AbstractProducedQuery.java:1487)
      at org.hibernate.query.internal.AbstractProducedQuery.uniqueResult(AbstractProducedQuery.java:1457)
      at com.atlassian.crowd.dao.directory.DirectorySynchronisationStatusDAOHibernate.findActiveInner(DirectorySynchronisationStatusDAOHibernate.java:29)
      at com.atlassian.crowd.dao.directory.DirectorySynchronisationStatusDAOHibernate.findActiveForDirectory(DirectorySynchronisationStatusDAOHibernate.java:23)
      

      Workaround

      The following steps should do the trick as it will remove the unfinished syncs from the DB:

      1. Shutdown Crowd.
      2. Run the following query against the database where Crowd runs:
        SELECT * FROM cwd_synchronisation_status;
        
      3. Confirm that rows are shown (all with statuses different than "SUCCESS_FULL")
      4. When confident, run the following query:
        DELETE FROM cwd_synchronisation_status WHERE id IN (<run on each directory ID that is giving us issues>);
        
      5. Run the following to confirm we now have only one row per directory:
        SELECT * FROM cwd_synchronisation_status;
        
      6. Start Crowd and check if the issue is resolved.

            [CWD-5429] multiple results in cwd_synchronisation_status table cause directory synchronisation failed

            Conny Postma made changes -
            Remote Link Original: This issue links to "Page (Atlassian Documentation)" [ 505597 ]
            Lei Wang made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 530188 ]
            Daniel Serkowski made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            Venkat Pattabiraman (Inactive) made changes -
            Remote Link New: This issue links to "Page (Atlassian Documentation)" [ 505597 ]
            Bugfix Automation Bot made changes -
            Support reference count Original: 4 New: 5
            Pawel Gruszczynski (Inactive) made changes -
            Status Original: In Progress [ 3 ] New: Waiting for Release [ 12075 ]
            Pawel Gruszczynski (Inactive) made changes -
            Status Original: Long Term Backlog [ 12073 ] New: In Progress [ 3 ]
            Pawel Gruszczynski (Inactive) made changes -
            Fix Version/s New: 4.2.0 [ 92192 ]
            Fix Version/s New: 4.1.2 [ 92395 ]
            Fix Version/s New: 4.0.4 [ 92396 ]
            Dawid Owoc (Inactive) made changes -
            Status Original: Needs Triage [ 10030 ] New: Long Term Backlog [ 12073 ]
            Dawid Owoc (Inactive) made changes -
            Labels New: crowd-triage-dev

              Unassigned Unassigned
              lwang3@atlassian.com Lei Wang
              Affected customers:
              0 This affects my team
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: