Alanxtl opened a new issue, #3819:
URL: https://github.com/apache/dubbo-go/issues/3819

   Part of #3614 (item 4).
   
   ### What happened?
   
   `go test -race` reports races in the Apollo listener and its test:
   
   - `apolloListener.OnNewestChange` iterates the listener map while 
`AddListener` or `RemoveListener` mutates it.
   - The mock server reads `mockConfigRes` while the test writes it.
   - Concurrent callbacks and the test access the test listener's `count` and 
`event` without proper synchronization; `Process` also calls `wg.Done()` before 
updating those fields.
   
   The listener-map problem was previously described in #3542; #3543 was closed 
without being merged. This issue covers the remaining production and test races 
reported by `TestListener`.
   
   ### Reproduction
   
   ```sh
   go test -race -count=1 ./config_center/apollo -run '^TestListener$'
   ```
   
   On `develop` at `6ea4f0817299973c5e17e73fea3710cf528c1426`, Go 1.26.3 on 
Windows, this command reported the map and test-state races.
   
   ### Expected outcome
   
   - Synchronize listener membership and iteration; dispatch callbacks safely 
without holding a lock across arbitrary listener code.
   - Synchronize the mock response and test listener state, including 
completion signaling.
   - Add or adapt meaningful concurrent coverage and verify `TestListener` 
repeatedly with `-race`.
   - Remove `TestListener` from `RACE_SKIP_TESTS` when it is safe to run in the 
full race suite.


-- 
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