Details
-
Bug
-
Resolution: Fixed
-
Medium
-
6.1-EAP
-
6.01
-
Description
Hi,
We are trying to migrate from JIRA 5.1.3 to JIRA 6.1. We have some trouble with LDAP synchronisation. JIRA is trying to update userName and throw the following exception :
2013-09-02 10:46:23,853 QuartzScheduler_Worker-0 ERROR ServiceRunner [atlassian.crowd.directory.DbCachingDirectoryPoller] Error occurred while refreshing the cache for directory [ 3 ]. com.atlassian.crowd.exception.OperationFailedException: Unable to rename user 'ut1gbh' to 'UT1GBH', please perform full synchronization. at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.updateUsers(DbCachingRemoteChangeOperations.java:232) at com.atlassian.crowd.directory.DirectoryCacheImplUsingChangeOperations.addOrUpdateCachedUsers(DirectoryCacheImplUsingChangeOperations.java:59) at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseUserChanges(UsnChangedCacheRefresher.java:220) at com.atlassian.crowd.directory.ldap.cache.UsnChangedCacheRefresher.synchroniseChanges(UsnChangedCacheRefresher.java:81) at com.atlassian.crowd.directory.DbCachingRemoteDirectory.synchroniseCache(DbCachingRemoteDirectory.java:667) at com.atlassian.crowd.manager.directory.DirectorySynchroniserImpl.synchronise(DirectorySynchroniserImpl.java:75) at com.atlassian.crowd.directory.DbCachingDirectoryPoller.pollChanges(DbCachingDirectoryPoller.java:50) at com.atlassian.crowd.manager.directory.monitor.poller.DirectoryPollerJob.execute(DirectoryPollerJob.java:34) at org.quartz.core.JobRunShell.run(JobRunShell.java:195) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) Caused by: com.atlassian.crowd.exception.UserAlreadyExistsException: User already exists in directory [3] with name [UT1GBH] at com.atlassian.crowd.directory.AbstractInternalDirectory.renameUser(AbstractInternalDirectory.java:559) at com.atlassian.crowd.directory.DbCachingRemoteChangeOperations.updateUsers(DbCachingRemoteChangeOperations.java:226) ... 9 more
I've checked into source code. For the version 5.1.3, you are using the version 2.4.3 of crowd-core module. In class com.atlassian.crowd.directory.DbCachingRemoteChangeOperations, we found ((line 997) ) :
if (!remoteUser.getName().equals(internalUser.getName())) { logger.warn("remote username [ {} ] casing differs from local username [ {} ]. User details will be kept updated, but the username cannot be updated", remoteUser.getName(), internalUser.getName()); } if (hasChanged(remoteUser, internalUser)) { final UserTemplate userToUpdate = makeUserTemplate(remoteUser); // Ensure that the username will not be updated userToUpdate.setName(internalUser.getName()); // Ignore active flag value from remote directory and manage it locally if the remote directory does not support active flag. if (!remoteDirectory.supportsInactiveAccounts()) userToUpdate.setActive(internalUser.isActive()); usersToUpdate.add(userToUpdate); } else { logger.trace("user [ {} ] unmodified, skipping", remoteUser.getName()); }
For JIRA 6.1-beta1, you are using version 2.7.0-m15 of crowd-core. In same class, we found following code (line 221) :
final User currentUser = internalDirectory.findUserByExternalId(externalId); try { if (!StringUtils.equals(currentUser.getName(), user.getName())) { internalDirectory.renameUser(currentUser.getName(), user.getName()); } } catch (UserAlreadyExistsException e) { // Make sure that one bogus user coming over the wire doesn't hose the entire sync. throw new OperationFailedException("Unable to rename user '" + currentUser.getName() + "' to '" + user.getName() + "', please perform full synchronization.", e);
In older version you are checking than username will not be updated, but this check was drop on new version.
Doing a full synchronisation doesn't correct the problem.