Uploaded image for project: 'HipChat'
  1. HipChat
  2. HCPUB-114

HipChat Server directory synchronization fails with query did not return a unique result

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • 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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              scovey Shanye
              Archiver:
              mandreacchio Michael Andreacchio

              Dates

                Created:
                Updated:
                Resolved:
                Archived: