fix(aws): preserve error chain with errors.Join, copy tags for goroutines#651
Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom Feb 13, 2026
Merged
Conversation
…ines Instance creation errors were formatted with %v, breaking the error chain. Use errors.Join so callers can inspect individual errors. Also copy p.Tags before the goroutine loop to prevent a future data race if Tags is ever modified during creation. Audit findings NVIDIA#11 (MEDIUM), NVIDIA#15 (MEDIUM). Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the AWS provider’s multinode instance creation path to (1) preserve underlying error chains when multiple instance creations fail, and (2) avoid sharing the provider’s tag slice across goroutines.
Changes:
- Copy
p.Tagsbefore spawning instance-creation goroutines to avoid sharing the same slice across concurrent workers. - Aggregate instance creation errors via
errors.Joinand wrap with%wto preserve error unwrapping (errors.Is/As).
| @@ -427,7 +432,7 @@ func (p *Provider) createInstances( | |||
| instanceName := fmt.Sprintf("%s-%s-%d", p.ObjectMeta.Name, role, index) | |||
| // Filter out the Name tag from p.Tags to avoid duplicates | |||
There was a problem hiding this comment.
The comment says it filters out the Name tag from p.Tags, but the loop now iterates over tagsCopy. Update the comment to match the code so it stays accurate for future maintenance.
Suggested change
| // Filter out the Name tag from p.Tags to avoid duplicates | |
| // Filter out the Name tag from tagsCopy to avoid duplicates |
Pull Request Test Coverage Report for Build 21962400672Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
%vwitherrors.Joinfor instance creation error aggregation, preserving error chainp.Tagsbefore goroutine loop to prevent potential data raceAudit Findings
pkg/provider/aws/cluster.goChanges
pkg/provider/aws/cluster.go: Useerrors.Joinfor error aggregation, copy tags before goroutine loopTest plan
gofmt— no formatting issuesgo build— compilesgo test ./pkg/...— all tests pass