From f6b6491623b8f0bf7c49181f73e4482c64593886 Mon Sep 17 00:00:00 2001 From: Ian Ferguson Date: Tue, 9 Feb 2021 17:46:01 -0500 Subject: [PATCH 1/3] fix deadlock condition in identity create+merge calls --- vault/identity_store_entities.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vault/identity_store_entities.go b/vault/identity_store_entities.go index efa1e51bda43..b68f69889530 100644 --- a/vault/identity_store_entities.go +++ b/vault/identity_store_entities.go @@ -164,6 +164,9 @@ func (i *IdentityStore) pathEntityMergeID() framework.OperationFunc { force := d.Get("force").(bool) // Create a MemDB transaction to merge entities + i.lock.Lock() + defer i.lock.Unlock() + txn := i.db.Txn(true) defer txn.Abort() @@ -172,7 +175,7 @@ func (i *IdentityStore) pathEntityMergeID() framework.OperationFunc { return nil, err } - userErr, intErr := i.mergeEntity(ctx, txn, toEntity, fromEntityIDs, force, true, false, true) + userErr, intErr := i.mergeEntity(ctx, txn, toEntity, fromEntityIDs, force, false, false, true) if userErr != nil { return logical.ErrorResponse(userErr.Error()), nil } From 521d329bfd543f8b9d82e489df5560ad86373960 Mon Sep 17 00:00:00 2001 From: Ian Ferguson Date: Wed, 10 Feb 2021 10:26:10 -0500 Subject: [PATCH 2/3] Include Changelog --- changelog/10877.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/10877.txt diff --git a/changelog/10877.txt b/changelog/10877.txt new file mode 100644 index 000000000000..511cc8119658 --- /dev/null +++ b/changelog/10877.txt @@ -0,0 +1 @@ +core/identity: Fix deadlock in entity merge endpoint. From 9fb3ea41a32a3262c581b06db522bc33059ea671 Mon Sep 17 00:00:00 2001 From: Ian Ferguson Date: Wed, 10 Feb 2021 10:47:53 -0500 Subject: [PATCH 3/3] Use correct changelog format --- changelog/10877.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog/10877.txt b/changelog/10877.txt index 511cc8119658..59f3983861f0 100644 --- a/changelog/10877.txt +++ b/changelog/10877.txt @@ -1 +1,3 @@ +```release-note:bug core/identity: Fix deadlock in entity merge endpoint. +```