kubernetes-sigs / cli-utils

This repo contains binaries that built from libraries in cli-runtime.
Apache License 2.0
154 stars 77 forks source link

fix: race condition in BuildInfo #468

Closed karlkfi closed 2 years ago

karlkfi commented 2 years ago

Historically, the objects in ApplyTask were being modified in the Start func by BuildInfo to remove the path annotation, but this can cause a race condition in the task runner if it tried to read the task objects.

Now a DeepCopy is made in BuildInfo instead. This avoids the race condition but broke mutation, which executes after BuildInfo on the original object. So we now extract the object from the into after BuildInfo and use that instead for mutations, filters, and events.

mortent commented 2 years ago

/approve

k8s-ci-robot commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: karlkfi, mortent

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/cli-utils/blob/master/OWNERS)~~ [mortent] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
haiyanmeng commented 2 years ago

/lgtm