mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Correct lock acquisition order in the pathEntityMergeID identity to fix deadlock condition (#10877)
This commit is contained in:
3
changelog/10877.txt
Normal file
3
changelog/10877.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
core/identity: Fix deadlock in entity merge endpoint.
|
||||||
|
```
|
||||||
@@ -164,6 +164,9 @@ func (i *IdentityStore) pathEntityMergeID() framework.OperationFunc {
|
|||||||
force := d.Get("force").(bool)
|
force := d.Get("force").(bool)
|
||||||
|
|
||||||
// Create a MemDB transaction to merge entities
|
// Create a MemDB transaction to merge entities
|
||||||
|
i.lock.Lock()
|
||||||
|
defer i.lock.Unlock()
|
||||||
|
|
||||||
txn := i.db.Txn(true)
|
txn := i.db.Txn(true)
|
||||||
defer txn.Abort()
|
defer txn.Abort()
|
||||||
|
|
||||||
@@ -172,7 +175,7 @@ func (i *IdentityStore) pathEntityMergeID() framework.OperationFunc {
|
|||||||
return nil, err
|
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 {
|
if userErr != nil {
|
||||||
return logical.ErrorResponse(userErr.Error()), nil
|
return logical.ErrorResponse(userErr.Error()), nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user