You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "bodapatisaikrishna (via GitHub)" <gi...@apache.org> on 2026/09/17 03:51:29 UTC
[PR] fix(router): prevent data race on router cache in TestRouteCacheGenerationRace [dubbo-go]
bodapatisaikrishna opened a new pull request, #3732:
URL: https://github.com/apache/dubbo-go/pull/3732
## What is the purpose of the change
In `cluster/router/chain/chain_test.go`, `genCheckRouter` was created to mirror `TagRouter`'s cache guard under concurrency. However, unlike `TagRouter` which protects its cached reference using an atomic pointer (`atomic.Pointer[router.Cache]`), `genCheckRouter` stored `cache` in a plain field without atomic synchronization.
During concurrent `SetInvokers` (which rebuilds the cache and invokes `accessor.SetCache(...)`) and `Route()` (which reads `r.cache`), Go's race detector detected unsynchronized read and write access on `r.cache`, causing `TestRouteCacheGenerationRace` to fail under `-race` and requiring it to be added to `RACE_SKIP_TESTS` in `Makefile`.
## Brief changelog
- Update `genCheckRouter.cache` to `atomic.Pointer[router.Cache]`, ensuring safe concurrent reads in `Route()` and stores in `SetCache()`.
- Remove `TestRouteCacheGenerationRace` from `RACE_SKIP_TESTS` in `Makefile` so it is actively checked by `make test-race`.
- Format `cluster/router/script/instance/js_instance_test.go` so `make check-fmt` succeeds.
## Verifying this change
- Verified `go test -race -v -run TestRouteCacheGenerationRace ./cluster/router/chain/...` passes with zero race warnings.
- Ran 10 consecutive executions of `TestRouteCacheGenerationRace` under `-race` with 100% pass rate.
- Verified `make check-fmt` passes cleanly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] fix(router): prevent data race on router cache in TestRouteCacheGenerationRace [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3732:
URL: https://github.com/apache/dubbo-go/pull/3732#issuecomment-5708196481
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3732) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3732&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3732&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3732&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3732&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3732&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3732)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] fix(router): prevent data race on router cache in TestRouteCacheGenerationRace [dubbo-go]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #3732:
URL: https://github.com/apache/dubbo-go/pull/3732#issuecomment-5708256281
## [Codecov](https://app.codecov.io/gh/apache/dubbo-go/pull/3732?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 56.93%. Comparing base ([`832124a`](https://app.codecov.io/gh/apache/dubbo-go/commit/832124aaacf0283445d379e935ff5d73695fa84d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8586f4c`](https://app.codecov.io/gh/apache/dubbo-go/commit/8586f4c0dc19f367ce2e51ed0ba6d42dd036c5f0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #3732 +/- ##
==========================================
- Coverage 56.94% 56.93% -0.01%
==========================================
Files 478 478
Lines 38635 38635
==========================================
- Hits 21999 21998 -1
Misses 14923 14923
- Partials 1713 1714 +1
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/dubbo-go/pull/3732?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] fix(router): prevent data race on router cache in TestRouteCacheGenerationRace [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on PR #3732:
URL: https://github.com/apache/dubbo-go/pull/3732#issuecomment-5724516150
1. the target branch should be develop
2. pls fix the ci fail
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] fix(router): prevent data race on router cache in TestRouteCacheGenerationRace [dubbo-go]
Posted by "bodapatisaikrishna (via GitHub)" <gi...@apache.org>.
bodapatisaikrishna commented on PR #3732:
URL: https://github.com/apache/dubbo-go/pull/3732#issuecomment-5724709898
Hi @Alanxtl, thanks for the review!
1. Updated the base branch to `develop`.
2. Rebased onto `upstream/develop` and resolved the CI format issue by removing the unintended formatting diff in `js_instance_test.go`. The patch now cleanly modifies only `cluster/router/chain/chain_test.go` (using `atomic.Pointer[router.Cache]` to avoid unsynchronized access) and `Makefile` (enabling `TestRouteCacheGenerationRace` under `-race`). `gofmt` and race tests pass cleanly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] fix(router): prevent data race on router cache in TestRouteCacheGenerationRace [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks merged PR #3732:
URL: https://github.com/apache/dubbo-go/pull/3732
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] fix(router): prevent data race on router cache in TestRouteCacheGenerationRace [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3732:
URL: https://github.com/apache/dubbo-go/pull/3732#issuecomment-5724709357
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3732) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3732&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3732&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3732&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3732&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3732&metric=new_duplicated_lines_density&view=list)
<!-- sqra-placement-anchor -->
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3732)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org