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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to