Stash synchronisation with Crowd fails.

Hello,

we currently evaluate Stash 3.2 (Starter Licences) and therefore i connected it to Crowd. However, i always get sychronisation error. A short google revealed that others facing the same problem and there were also a workarounds like restart stash and recreate the directory. All of those steps didn't help. Currently Jira, Confluence, Bamboo, Fisheye are also connected to Crowd but don't have this issue. Any ideas what might be wrong

2014-07-31 08:54:44,845 ERROR [clusterScheduler_Worker-4] c.a.c.d.DbCachingDirectoryPoller Error occurred while refreshing the cache for directory [ 327681 ].

org.hibernate.NonUniqueResultException: query did not return a unique result: 2

at org.hibernate.internal.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:975) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final]

at org.hibernate.internal.CriteriaImpl.uniqueResult(CriteriaImpl.java:402) ~[hibernate-core-4.3.5.Final.jar:4.3.5.Final]

at com.atlassian.crowd.dao.user.UserDAOHibernate.findByExternalId(UserDAOHibernate.java:204) ~[crowd-persistence-hibernate4-2.7.2.jar:na]

at com.atlassian.crowd.dao.user.UserDAOHibernate.findByExternalId(UserDAOHibernate.java:50) ~[crowd-persistence-hibernate4-2.7.2.jar:na]

at com.atlassian.crowd.directory.AbstractInternalDirectory.findUserByExternalId(AbstractInternalDirectory.java:157) ~[crowd-persistence-2.7.2.jar:na]

at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.updateUsers(DbCachingRemoteChangeOperations.java:224) ~[crowd-core-2.7.2.jar:na]

at com.atlassian.crowd.directory.$Proxy1662.updateUsers(Unknown Source) ~[na:na]

at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.addOrUpdateCachedUsers(DirectoryCacheImplUsingChangeOperations.java:59) ~[crowd-core-2.7.2.jar:na]

at com.atlassian.crowd.directory.ldap.cache.RemoteDirectoryCacheRefresher.synchroniseAllUsers(RemoteDirectoryCacheRefresher.java:68) ~[crowd-ldap-2.7.2.jar:na]

at com.atlassian.crowd.directory.ldap.cache.AbstractCacheRefresher.synchroniseAll(AbstractCacheRefresher.java:78) ~[crowd-ldap-2.7.2.jar:na]

at com.atlassian.crowd.directory.ldap.cache.EventTokenChangedCacheRefresher.synchroniseAll(EventTokenChangedCacheRefresher.java:71) ~[crowd-ldap-2.7.2.jar:na]

at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:1008) ~[crowd-core-2.7.2.jar:na]

at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:75) ~[crowd-core-2.7.2.jar:na]

at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50) ~[crowd-core-2.7.2.jar:na]

at com.atlassian.stash.internal.crowd.DirectoryPollerJobRunner.runJob(DirectoryPollerJobRunner.java:71) [stash-service-impl-3.2.0.jar:na]

at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:127) [atlassian-scheduler-core-1.2.2.jar:na]

at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101) [atlassian-scheduler-core-1.2.2.jar:na]

at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80) [atlassian-scheduler-core-1.2.2.jar:na]

at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32) [atlassian-scheduler-quartz1-1.2.2.jar:na]

at org.quartz.core.JobRunShell.run(JobRunShell.java:223) [quartz-1.8.6.jar:na]

at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549) [quartz-1.8.6.jar:na]

... 40 frames trimmed

4 answers

1 accepted

0 votes
Accepted answer

Hi Andreas,

There was a known bug regarding this. Can you raise a support ticket so the support team can look at this? Thanks.

Regards,

Deric

Hi Andreas,

Can you check if you have duplicate entries in "cwd_membership" table in the database? You can run this query to check for duplicates:

SELECT directory_id, lower_parent_name, lower_child_name, membership_type, COUNT(*) as cnt
FROM cwd_membership
GROUP BY directory_id, lower_parent_name, lower_child_name, membership_type
HAVING COUNT(*) > 1;

If this returns any duplicate, you can use this query to check for the duplicate rows

SELECT * 
FROM cwd_membership
WHERE directory_id in 
	(SELECT directory_id
	FROM cwd_membership
	GROUP BY directory_id, lower_parent_name, lower_child_name, membership_type
	HAVING COUNT(*) > 1)
AND lower_parent_name in 
	(SELECT lower_parent_name
	FROM cwd_membership
	GROUP BY directory_id, lower_parent_name, lower_child_name, membership_type
	HAVING COUNT(*) > 1)
AND lower_child_name in 
	(SELECT lower_child_name
	FROM cwd_membership
	GROUP BY directory_id, lower_parent_name, lower_child_name, membership_type
	HAVING COUNT(*) > 1)
AND membership_type in 
	(SELECT membership_type
	FROM cwd_membership
	GROUP BY directory_id, lower_parent_name, lower_child_name, membership_type
	HAVING COUNT(*) > 1);

What database are you using? HSQL and db2 are known to have issues with table uniqueness constraint.

Regards,

Deric

Hi Deric,

we currently use PostgreSQL 9.2 for all Atlassian Products. I executed the first query but there were no entries returned.

Regards,

Andreas

Hi Deric,

thanks for the help :D I will raise a support ticket.

Regards,

Andreas

What was the result of the support ticket? I'm getting the same error, and I found this thread via google.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

224 views 3 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you