beautyarbutin opened a new pull request, #11247:
URL: https://github.com/apache/rocketmq/pull/11247

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11246
   
   ### Brief Description
   
   `NettyRemotingClient.updateNameServerAddressList` shuffled and retained the 
caller's list. This made a two-address read-only list fail with 
`UnsupportedOperationException` and allowed subsequent mutations of a mutable 
input list to change the client's NameServer addresses without another update 
call.
   
   Copy the accepted list before shuffling and storing it. The copy is also 
used when checking whether the currently selected address remains present. This 
keeps the existing selection and update behavior while removing the input alias.
   
   The affected path is direct use of the public `RemotingClient` API with a 
read-only or reused list. Built-in string-based wrappers usually pass fresh 
mutable lists.
   
   ### How Did You Test This Change?
   
   - Added regression tests for a read-only input and for mutating the input 
after update. The latter failed before the fix because the stored address list 
became empty.
   - Ran `mvn -pl remoting -am -Dtest=NettyRemotingClientTest 
-Dsurefire.failIfNoSpecifiedTests=false -Dspotbugs.skip test` with Temurin JDK 
8u504 on Windows 11: 18 tests passed, 0 failed, 0 errors.
   - Checkstyle reported 0 violations; `git diff --check` passed.
   


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

Reply via email to