Skip to content

fix scheme data race - #7820

Merged
zirain merged 6 commits into
envoyproxy:mainfrom
zhaohuabing:fix-scheme-data-race
Dec 26, 2025
Merged

zirain merged 6 commits into
envoyproxy:mainfrom
zhaohuabing:fix-scheme-data-race

Conversation

@zhaohuabing

@zhaohuabing zhaohuabing commented Dec 26, 2025 •

Copy link
Copy Markdown
Member

This PR builds a runtime.Scheme and pre-registers custom backend GVKs before constructing the fake client. This prevents controller-runtime’s fake client from lazily mutating the shared scheme during List, eliminating the data race between scheme writes and informer reads.

fixes: #7816

@zhaohuabing
zhaohuabing requested a review from a team as a code owner December 26, 2025 02:10
zirain
zirain previously approved these changes Dec 26, 2025
@codecov

codecov Bot commented Dec 26, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.63%. Comparing base (cec35e6) to head (17010ee).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7820      +/-   ##
==========================================
- Coverage   72.65%   72.63%   -0.03%     
==========================================
  Files         235      235              
  Lines       34876    34876              
==========================================
- Hits        25340    25333       -7     
- Misses       7732     7739       +7     
  Partials     1804     1804              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zhaohuabing
zhaohuabing requested review from a team and zirain December 26, 2025 02:36
Signed-off-by: Huabing Zhao <[email protected]>
zirain
zirain previously approved these changes Dec 26, 2025
Signed-off-by: Huabing Zhao <[email protected]>
@zhaohuabing
zhaohuabing requested review from a team December 26, 2025 03:24
@zirain

zirain commented Dec 26, 2025

Copy link
Copy Markdown
Member

/retest

@kkk777-7

Copy link
Copy Markdown
Member

LGTM, thanks!

@zirain
zirain merged commit 88cb876 into envoyproxy:main Dec 26, 2025
@zhaohuabing
zhaohuabing deleted the fix-scheme-data-race branch December 26, 2025 06:47
@rudrakhp

Copy link
Copy Markdown
Member

@zhaohuabing this seems to cause test failures even after retries, removing this commit fixes it.

--- FAIL: TestNamespacedProvider (28.81s)
    kubernetes_test.go:1276: 
        	Error Trace:	/home/runner/work/gateway/gateway/internal/provider/kubernetes/kubernetes_test.go:1276
        	            				/home/runner/work/gateway/gateway/internal/provider/kubernetes/kubernetes_test.go:1307
        	Error:      	Received unexpected error:
        	            	timeout waiting for process kube-apiserver to stop
        	Test:       	TestNamespacedProvider

@zhaohuabing

Copy link
Copy Markdown
Member Author

@zhaohuabing this seems to cause test failures even after retries, removing this commit fixes it.

--- FAIL: TestNamespacedProvider (28.81s)
    kubernetes_test.go:1276: 
        	Error Trace:	/home/runner/work/gateway/gateway/internal/provider/kubernetes/kubernetes_test.go:1276
        	            				/home/runner/work/gateway/gateway/internal/provider/kubernetes/kubernetes_test.go:1307
        	Error:      	Received unexpected error:
        	            	timeout waiting for process kube-apiserver to stop
        	Test:       	TestNamespacedProvider

@rudrakhp this should have been fixed in #7817 .

millermatt pushed a commit to millermatt/envoy-gateway that referenced this pull request Jan 4, 2026
* fix scheme data race

Signed-off-by: Huabing Zhao <[email protected]>

* fix scheme data race for TestGetExtensionBackendResources

Signed-off-by: Huabing Zhao <[email protected]>

* fix more tests

Signed-off-by: Huabing Zhao <[email protected]>

* use test context

Signed-off-by: Huabing Zhao <[email protected]>

* add -race to kube test

Signed-off-by: Huabing Zhao <[email protected]>

* minor change

Signed-off-by: Huabing Zhao <[email protected]>

---------

Signed-off-by: Huabing Zhao <[email protected]>
Signed-off-by: Matt Miller <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DATA RACE: TestProcessHTTPRoutesWithCustomBackends

4 participants