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?

 

 

 

2 answers

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

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 Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

630 views 0 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot