Confluence does not complete User Directory synchronization when a user is duplicated in multiple OUs
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Directory synchronization from an external LDAP directory is not successfully synchronizing all users.
Diagnosis
The following appears in the atlassian-confluence.log
2018-03-23 18:13:04,980 ERROR [Caesium-1-1] [engine.jdbc.spi.SqlExceptionHelper] logExceptions ERROR: duplicate key value violates unique constraint "cwd_user_name_dir_id"
Detail: Key (lower_user_name, directory_id)=(<username>, 3276801) already exists.
2018-03-23 18:13:05,055 ERROR [Caesium-1-1] [crowd.embedded.hibernate2.HibernateUserDao] addAll The following users could not be processed:
2018-03-23 18:13:05,056 ERROR [Caesium-1-1] [crowd.embedded.hibernate2.HibernateUserDao] addAll aliceb
2018-03-23 18:13:05,056 ERROR [Caesium-1-1] [crowd.embedded.hibernate2.HibernateUserDao] addAll christinej
2018-03-23 18:13:05,056 ERROR [Caesium-1-1] [crowd.embedded.hibernate2.HibernateUserDao] addAll Please try to resolve any errors with these users, and try again.
Cause
This can be caused by a user existing in multiple OUs in LDAP and more than one of the OUs are being pulled into the user directory in Confluence. Once the duplicated user is hit, directory synchronization for the remaining users is not completed.
Workaround
To resolve the issue eliminate the duplicate from being pulled into Confluence by:
- Redefine the scope of the LDAP directory in Confluence to exclude one of the OUs so that it does not pull the user twice
- Or remove the user from one of the duplicated OUs
- Or create multiple user directories making sure that the set of users being retrieved in each user directory is unique.
We have a feature request open for allowing synchronization to continue after skipping the duplicate: CONFSERVER-55246 - Getting issue details... STATUS