Fix the race on the registered conversion paths in conversion.Convert#545
Merged
ulucinar merged 1 commit intocrossplane:mainfrom Oct 28, 2025
Merged
Fix the race on the registered conversion paths in conversion.Convert#545ulucinar merged 1 commit intocrossplane:mainfrom
ulucinar merged 1 commit intocrossplane:mainfrom
Conversation
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
1 task
sergenyalcin
approved these changes
Oct 24, 2025
Member
sergenyalcin
left a comment
There was a problem hiding this comment.
Thank you very much @ulucinar for catching and fixing this. LGTM!
This was referenced Oct 29, 2025
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.
Description of your changes
Multiple Go routines can race on the registered conversion paths when in-place sorts are performed in
conversion.Convert. Although we could not reproduce these issues like the one reported in crossplane-contrib/provider-upjet-aws#1714, observations done by @jonathan-innis here using a provider package with the fix proposed in this PR suggest that this data race could be the underlying reason behind similar failures.This PR fixes the data race by making a copy of the list of the registered conversion paths before they are sorted in-place.
I have:
make reviewableto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
We have tested the data race fix using the provider package
xpkg.upbound.io/upbound/provider-aws-lambda:v1.20.5-1.gf4470285b. There are logging differences between that implementation and the one proposed here. The test image has more verbose logging, which is not suggested with this PR due to concerns with PII.