Bitbucket Server sync problem with Active directory

Were facing a syncing problem on Bitbucket Server (v3.11.2)

The full sync fails on refreshing the cache. The relevant log entries  are here:

2015-11-03 07:44:14,480 INFO  [clusterScheduler_Worker-7]  c.a.s.i.user.HibernateStashUserDao Archiving user madh with slug madh to madh_ar/madh_ar

2015-11-03 07:44:14,495 WARN  [clusterScheduler_Worker-7]  o.h.e.jdbc.spi.SqlExceptionHelper SQL Error: 2627, SQLState: 23000

2015-11-03 07:44:14,495 ERROR [clusterScheduler_Worker-7]  o.h.e.jdbc.spi.SqlExceptionHelper Violation of UNIQUE KEY constraint 'uk_mem_dir_parent_child'. Cannot insert duplicate key in object 'dbo.cwd_membership'. The duplicate key value is (3309569, madh, z_gis_owa_2010, GROUP_USER).

2015-11-03 07:44:14,495 WARN  [clusterScheduler_Worker-7]  o.h.e.jdbc.spi.SqlExceptionHelper SQL Warning Code: 3621, SQLState: S0000

2015-11-03 07:44:14,495 WARN  [clusterScheduler_Worker-7]  o.h.e.jdbc.spi.SqlExceptionHelper The statement has been terminated.

2015-11-03 07:44:14,573 ERROR [clusterScheduler_Worker-7]  c.a.c.d.DbCachingDirectoryPoller Error occurred while refreshing the cache for directory [ 3309569 ].

 

What can I do to remove the duplicate key error?

 

 

 

3 answers

1 accepted

This widget could not be displayed.

Hi @Harald Mueller,

Usually these issues are caused by a problem with the directory synchronization.

 

To resolve them, let's try to recreate the user directory by following these steps:

- Disable the existing external user directories

- Create new user directories with the same settings as the older ones

- If everything works fine, delete the older user directories to keep a clean configuration

 

Here the link to the External user directories configuration.

 

Cheers,

Caterina - Atlassian

This widget could not be displayed.

I have the exact same error running on Bitbucket v4.4

It appears this AD user was expired within AD at some point but then i expect the account was re-enabled.

Bitbucket LDAP config:  Filter out expired users was enabled.  

i've disabled this and attempted to re-sync again but still get the same error.



2016-05-26 18:30:59,290 INFO  [clusterScheduler_Worker-5]  c.a.s.i.user.HibernateStashUserDao Archiving user m041489 with slug m041489 to m041489_ar/m041489_ar

2016-05-26 18:30:59,314 WARN  [clusterScheduler_Worker-5]  o.h.e.jdbc.spi.SqlExceptionHelper SQL Error: 2627, SQLState: 23000

2016-05-26 18:30:59,314 ERROR [clusterScheduler_Worker-5]  o.h.e.jdbc.spi.SqlExceptionHelper Violation of UNIQUE KEY constraint 'uk_mem_dir_parent_child'. Cannot insert duplicate key in object 'dbo.cwd_membership'. The duplicate key value is (229377, m041489, wbc information technology-resource-all users, GROUP_USER).

2016-05-26 18:30:59,314 WARN  [clusterScheduler_Worker-5]  o.h.e.jdbc.spi.SqlExceptionHelper SQL Warning Code: 3621, SQLState: S0000

2016-05-26 18:30:59,314 WARN  [clusterScheduler_Worker-5]  o.h.e.jdbc.spi.SqlExceptionHelper The statement has been terminated.

2016-05-26 18:30:59,364 ERROR [clusterScheduler_Worker-5]  c.a.c.d.DbCachingDirectoryPoller Error occurred while refreshing the cache for directory [ 229377 ].

org.hibernate.exception.ConstraintViolationException: could not execute statement

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of UNIQUE KEY constraint 'uk_mem_dir_parent_child'. Cannot insert duplicate key in object 'dbo.cwd_membership'. The duplicate key value is (229377, m041489, wbc information technology-resource-all users, GROUP_USER).

This widget could not be displayed.

We experience it too on 4.6.3 connecting to Active Directory

Any luck with this issue? Did you manage to identify the cause?

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,315 views 8 11
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