Gitesg opened a new pull request, #3830: URL: https://github.com/apache/dubbo-go/pull/3830
### Description Fixes #3819 Fixes data races in the Apollo configuration center listener and its tests. - Protect the Apollo listener map with `sync.RWMutex`. - Dispatch change events using a snapshot of registered listeners, invoking callbacks outside the lock. - Synchronize access to the shared mock response and `apolloDataListener` state. - Signal test completion only after updating listener state. - Add a concurrent listener access test that detects races when synchronization is removed. ### Verification The following tests passed: ```bash go test -race -count=5 -run 'TestListener|TestApolloListener' ./config_center/apollo/ go test -race -count=3 ./config_center/apollo/ -skip '^TestListener$' ``` `TestListener` remains in `RACE_SKIP_TESTS` because running it after tests that start an Agollo client can expose a separate race inside Agollo (`getAppConfig` vs `SyncAndUpdate`). Also ran `make fmt` and `git diff --check`. The full `make test` suite was not run. ### Checklist - [x] I confirm the target branch is `develop` - [x] I have run `make fmt` to format my code - [ ] I have run `make test` to run local tests - [x] I have added tests that prove my fix is effective or that my feature works -- 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]
