-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
api: data race when calling Kustomizer.Run()
from multiple goroutines
#4824
Comments
This package kustomize/kyaml/openapi/openapi.go Line 28 in 2ec4b97
kubernetesOpenAPIVersion in many places.
|
I agree with your assessment of why this is happening, and that ideally we wouldn't use global variables (these days we have a linter in place to flag them to help prevent problems like this from being introduced). I suspect the fix may be quite involved though, as performance is a big issue with openapi; we'd likely need the Kustomize layer to start holding the state the global variable is being used for, and any PR would need to have performance benchmarks. I'll accept the issue, but for transparency I don't think this is likely to be taken on by the Kustomize team ourselves; our bandwidth is very limited and this doesn't affect the /triage accepted |
@KnVerey: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Understood. Thanks for your response. How would you feel about introducing a lock on that variable, and making it be accessed/set from a |
Yes, you're right, that should also work and I would be happy to accept a contribution to that effect. If you're interested, please |
Describe the bug
Data race occurs when
Kustomizer.Run()
is called from multiple goroutines.The culprit seems to be in
openapi.SetSchema()
which manipulates the global variable:kubernetesOpenAPIVersion
Files that can reproduce the issue
Expected output
No data race
Actual output
Data race.
Stack trace:
Kustomize version
sigs.k8s.io/kustomize/api v0.12.1
Additional context
Related issue: Kong/kubernetes-testing-framework#404
If that's the intended behaviour then at the very least the API should have a note saying that this cannot be called from multiple goroutines.
The text was updated successfully, but these errors were encountered: