Repository navigation
Conversation
refreshCache fetches each package and its per-channel bundles from its own goroutine, but the OneCatalog/ManyPackages/OneMissingBundle/Elided case programs its counterfeiter stubs with call-index-bound returns (GetPackageReturnsOnCall / GetBundleForChannelReturnsOnCall). Counterfeiter stubs do not inspect request arguments: ReturnsOnCall(i) hands response i to whichever goroutine happens to issue the i-th call. When the two package goroutines interleave between their GetPackage and GetBundleForChannel calls, the responses cross-wire: the goroutine processing the "has-bundle" package receives the index-0 "no bundle found" error and elides it, while the goroutine processing "no-bundle" receives the index-1 good bundle and caches a manifest for it. The test then fails with the wrong package elided (expected [has-bundle], actual [no-bundle]). The provider is correct -- a real registry answers per request; only the test assumed a serialization that refreshCache does not provide. The race detector does not flag this because counterfeiter fakes are internally mutex-synchronized: it is a semantic ordering dependency, not a data race. Replace the index-bound stubs with argument-aware stub functions that key responses off the requested package and channel, keeping the scenario semantics (no-bundle's channel errors, has-bundle resolves) while being independent of goroutine scheduling. Observed failing run (go test -race -count=1, downstream OpenShift CI): https://prow.ci.openshift.org/view/gs/test-platform-results-public/pr-logs/pull/openshift_operator-framework-olm/1396/pull-ci-openshift-operator-framework-olm-main-unit-olm/2116233294835093504 Signed-off-by: grokspawn <jordan@nimblewidget.com>
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
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
TestRegistryProviderList/OneCatalog/ManyPackages/OneMissingBundle/Elidedfails intermittently with the wrong package elided: the assertion expects[has-bundle]but gets[no-bundle], preceded by:Root cause
RegistryProvider.refreshCache(pkg/package-server/provider/registry.go) spawns one goroutine per package returned byListPackages; each goroutine callsclient.GetPackage(...)and then, insidenewPackageManifest,client.GetBundleForChannel(...).The test programs its counterfeiter stubs with call-index-bound returns (
GetPackageReturnsOnCall,GetBundleForChannelReturnsOnCall). Counterfeiter stubs do not inspect request arguments:ReturnsOnCall(i)hands responseito whichever goroutine happens to issue the i-th call. When the two package goroutines interleave between theirGetPackageandGetBundleForChannelcalls, the responses cross-wire: the goroutine processing the "has-bundle" package receives the index-0 error and elides it, while the goroutine processing "no-bundle" receives the index-1 good bundle and caches a manifest for it.The provider is correct — a real registry answers per request; only the test assumed a serialization that
refreshCachedoes not provide. The race detector does not flag this because counterfeiter fakes are internally mutex-synchronized: it is a semantic ordering dependency, not a data race.The remaining index-bound stub sites in this file are single-package, multi-channel scenarios:
newPackageManifestprocesses a package's channels serially in sorted order within one goroutine, so those are deterministic and left unchanged.Fix
Replace the index-bound stubs with argument-aware stub functions keyed on the requested package and channel, preserving the scenario semantics (no-bundle's channel errors, has-bundle resolves) while being independent of goroutine scheduling.
Validation
go test -race -count=5 -run TestRegistryProviderList ./pkg/package-server/provider/passespkg/package-server/providersuite passes under-raceFailing run (downstream OpenShift CI,
go test -race -count=1; the identical tree passed the day before and the package is unchanged between the runs):https://prow.ci.openshift.org/view/gs/test-platform-results-public/pr-logs/pull/openshift_operator-framework-olm/1396/pull-ci-openshift-operator-framework-olm-main-unit-olm/2116233294835093504