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

   ### Which Issue(s) This PR Fixes
   
   Fixes #11515
   
   ### Brief Description
   
   `RemotingHelper.connect` wired the socket buffer knobs to the wrong options: 
`socketSndbufSize` was applied with `setReceiveBufferSize` and 
`socketRcvbufSize` with `setSendBufferSize`. Every other place in the remoting 
module maps `socketSndbufSize` to `SO_SNDBUF` and `socketRcvbufSize` to 
`SO_RCVBUF` (see `NettyRemotingClient` and `NettyRemotingServer`), so these two 
were swapped.
   
   The store HA replication clients (`DefaultHAClient`, `AutoSwitchHAClient`) 
connect through this method, so tuning the buffer sizes gave the replication 
sockets the opposite send/receive buffer from what was configured.
   
   This PR sets the send buffer from `socketSndbufSize` and the receive buffer 
from `socketRcvbufSize`.
   
   ### How Did You Test This Change?
   
   Added 
`RemotingHelperTest#testConnectAppliesSndAndRcvBufferToMatchingSocketOption`. 
The OS clamps and scales requested buffer sizes, so the test opens two 
connections that differ only in `socketSndbufSize` and reads back the send 
buffer from both: the connection configured with the smaller send buffer must 
end up with the smaller send buffer. With the knobs swapped the send buffer 
follows `socketRcvbufSize`, which inverts the comparison and fails the test.
   
   Verified the test fails before the change and passes after, with `mvn -pl 
remoting -am test -Dtest=RemotingHelperTest`.
   
   AI-assisted; directed, reviewed and tested by the author (amalsaidov).
   


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