Details
-
Bug
-
Resolution: Won't Fix
-
Medium
-
None
-
HCS 1.3.4, HCS 1.3.7
-
None
-
Severity 2 - Major
Description
It is possible for duplicate entries to exist in HipChat Server's crowd database tables, leading to failed synchronizations with external user directories.
Environment
- HipChat Server v1.3.4 or v1.3.7
- Configured to synchronize with an external user directory (LDAP, Crowd, Active Directory, etc.)
Steps to Reproduce
The steps to reproduce the root cause of this behavior are not currently known.
Expected Results
Synchronization with external user directory is successful.
Actual Results
Synchronization with the external directory fails, as reflected at Server admin >> Directory.
Scenario 1 - duplicate row in cwd_membership
The below exception is thrown in the /home/admin/logs/atlassian-crowd.log file: com.atlassian.crowd.dao.membership.MembershipDAOHibernate.findInternalMembership
2015-12-03 09:51:06,437 scheduler_Worker-4 ERROR [atlassian.crowd.directory.DbCachingDirectoryPoller] Error occurred while refreshing the cache for directory [ 393217 ]. org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.hibernate.internal.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:918) at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396) at com.atlassian.crowd.dao.membership.MembershipDAOHibernate.findInternalMembership(MembershipDAOHibernate.java:370) at com.atlassian.crowd.dao.membership.MembershipDAOHibernate.isUserDirectMember(MembershipDAOHibernate.java:213) at com.atlassian.crowd.directory.AbstractInternalDirectory.isUserDirectGroupMember(AbstractInternalDirectory.java:893) at com.atlassian.crowd.directory.AbstractInternalDirectory.removeUserFromGroup(AbstractInternalDirectory.java:945) at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.removeUserMembershipsForGroup(DbCachingRemoteChangeOperations.java:812) at sun.reflect.GeneratedMethodAccessor170.invoke(Unknown Source)
Scenario 2 - duplicate row in cwd_user
The below exception is thrown in the /home/admin/logs/atlassian-crowd.log file: com.atlassian.crowd.dao.user.UserDAOHibernate.findByExternalId
2016-01-28 17:50:02,838 scheduler_Worker-5 ERROR [atlassian.crowd.directory.DbCachingDirectoryPoller] Error occurred while refreshing the cache for directory [ 425985 ]. org.hibernate.NonUniqueResultException: query did not return a unique result: 2 at org.hibernate.internal.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:918) at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:396) at com.atlassian.crowd.dao.user.UserDAOHibernate.findByExternalId(UserDAOHibernate.java:213) at com.atlassian.crowd.dao.user.UserDAOHibernate.findByExternalId(UserDAOHibernate.java:55) at com.atlassian.crowd.directory.AbstractInternalDirectory.findUserByExternalId(AbstractInternalDirectory.java:182) at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.userByExternalIdOrNull(DbCachingRemoteChangeOperations.java:293) at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.updateUsers(DbCachingRemoteChangeOperations.java:233) at sun.reflect.GeneratedMethodAccessor464.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
Workaround
A workaround exists for this behavior, but may require direct database modification. Please contact HipChat Server Support for assistance.