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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelog/13476.txt
@@ -0,0 +1,3 @@
```release-note:bug
core/identity: Address a data race condition between local updates to aliases and invalidations
```
5 changes: 2 additions & 3 deletions vault/identity_store.go
Expand Up @@ -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
}
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion vault/identity_store_util.go
Expand Up @@ -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
}
Expand Down