Copy authz for goroutine in RA. (#3508)

There's a minor data race in UpdateAuthorization where the authorization can
be changed in the goroutine concurrently with returning it. This fixes it by
copying the authorization as an argument to the goroutine.

Fixes #3506.
This commit is contained in:
Jacob Hoffman-Andrews 2018-03-02 10:52:24 -08:00 committed by Roland Bracewell Shoemaker
parent f2d3ad6d52
commit 5d1a3bbf36
1 changed files with 2 additions and 2 deletions

View File

@ -1486,7 +1486,7 @@ func (ra *RegistrationAuthorityImpl) UpdateAuthorization(ctx context.Context, ba
// Dispatch to the VA for service
vaCtx := context.Background()
go func() {
go func(authz core.Authorization) {
records, err := ra.VA.PerformValidation(vaCtx, authz.Identifier.Value, authz.Challenges[challengeIndex], authz)
var prob *probs.ProblemDetails
if p, ok := err.(*probs.ProblemDetails); ok {
@ -1518,7 +1518,7 @@ func (ra *RegistrationAuthorityImpl) UpdateAuthorization(ctx context.Context, ba
"Could not record updated validation: err=[%s] regID=[%d] authzID=[%s]",
err, authz.RegistrationID, authz.ID))
}
}()
}(authz)
ra.stats.Inc("UpdatedPendingAuthorizations", 1)
return authz, nil
}