Incremental synchronisation failed due to cache returned different number of guids and users
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Problem
LDAP incremental synchronization fails and thrown an exception in the JIRA log.
The following appears in the atlassian-jira.log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2015-06-24 05:11:48,382 atlassian-scheduler-quartz1.clustered_Worker-4 ERROR ServiceRunner [atlassian.crowd.directory.DbCachingRemoteDirectory] Incremental synchronisation for directory [ 10200 ] was unexpectedly interrupted, falling back to a full synchronisation
com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresherIncSyncException: Cache returned different number of guids and users (possible reason is overlapping guids in cache, most likely null/empty values).
at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.validateAndReturnGuidsToAddAndDelete(UsnChangedCacheRefresher.java:287)
at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseUserChangesGuid(UsnChangedCacheRefresher.java:320)
at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseUserChanges(UsnChangedCacheRefresher.java:381)
at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseChanges(UsnChangedCacheRefresher.java:124)
at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:1097)
at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:76)
at com.atlassian.jira.crowd.embedded.JiraDirectorySynchroniser.synchronizeDirectory(JiraDirectorySynchroniser.java:96)
at com.atlassian.jira.crowd.embedded.JiraDirectorySynchroniser.runJob(JiraDirectorySynchroniser.java:60)
at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:136)
at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:101)
at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:80)
at com.atlassian.scheduler.quartz1.Quartz1Job.execute(Quartz1Job.java:32)
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Diagnosis
Environment
Active Directory 2008
JIRA 6.4.x
Diagnostic Steps
Run the SQL query below in database to identify the inconsistent records:
1 2 3
SELECT id, user_name, directory_id, external_id FROM cwd_user WHERE (external_id IN (SELECT external_id FROM cwd_user WHERE directory_id = '<user_directory_id>' GROUP BY external_id HAVING count(external_id) > 1) OR external_id IS NULL) AND directory_id = '<user_directory_id>';
ℹ️<user_directory_id> can be found in the cwd_directory table.
Please check the following before proceeding on the workaround:
There is result gotten from above query
Crosscheck from the result and verify the user does not exist on your external directory, then only proceed to workaround
IF after performing crosscheck, you notice that the result gotten leads to users that exist in external directory, contact Support for further investigation
Cause
The number of users in JIRA does not match with the number of GUIDs (External IDs) of the users in AD.
Some users has a NULL value in the External ID columns from the cwd_user table.
Solution
Workaround
The workaround will be inserting some dummy entries to the external id in cwd_user table to bypass the exception.
Stop JIRA.
Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Run the SQL command below:
1
UPDATE cwd_user SET external_id = '<user_name>' WHERE id = <id>;
ℹ️ Replace <user_name> and <id> from the SQL output in Diagnostic Steps.
Restart JIRA.
Was this helpful?