Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to address a data race issue within identity store - take 2 #13476

Merged
merged 2 commits into from
Dec 22, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Attempt to address a data race issue within identity store
 - Testcase TestIdentityStore_LocalAliasInvalidations identified a data race issue.
 - This reverts the previous attempt to address the issue from #13093
stevendpclark committed Dec 20, 2021
commit e23bfe2262e840e8506ef0ae718a72a4c1c4a5c8
5 changes: 2 additions & 3 deletions vault/identity_store.go
Original file line number Diff line number Diff line change
@@ -751,7 +751,7 @@ func (i *IdentityStore) CreateOrFetchEntity(ctx context.Context, alias *logical.
}

// Check if an entity already exists for the given alias
entity, err = i.entityByAliasFactors(alias.MountAccessor, alias.Name, false)
entity, err = i.entityByAliasFactors(alias.MountAccessor, alias.Name, true)
if err != nil {
return nil, err
}
@@ -838,8 +838,7 @@ func (i *IdentityStore) CreateOrFetchEntity(ctx context.Context, alias *logical.
}

txn.Commit()

return entity, nil
return entity.Clone()
}

// changedAliasIndex searches an entity for changed alias metadata.
2 changes: 1 addition & 1 deletion vault/identity_store_util.go
Original file line number Diff line number Diff line change
@@ -695,7 +695,7 @@ func (i *IdentityStore) processLocalAlias(ctx context.Context, lAlias *logical.A
return nil, fmt.Errorf("mount accessor %q is not local", lAlias.MountAccessor)
}

alias, err := i.MemDBAliasByFactors(lAlias.MountAccessor, lAlias.Name, true, false)
alias, err := i.MemDBAliasByFactors(lAlias.MountAccessor, lAlias.Name, false, false)
if err != nil {
return nil, err
}