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.

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

                Created:
                Updated:
                Resolved: