qianye1001 opened a new pull request, #11494:
URL: https://github.com/apache/rocketmq/pull/11494
### Which Issue(s) This PR Fixes
Fixes #11493
### Brief Description
`HeartbeatSyncer.consumeMessage` previously inserted every decoded channel
into `remoteChannelMap` before checking the heartbeat type. An unmatched
UNREGISTER could therefore create a map entry without any corresponding
consumer registration or `CLIENT_UNREGISTER` event to remove it.
This change:
- creates or reuses cached remote channels only for REGISTER heartbeats;
- processes UNREGISTER with an existing cached channel;
- ignores UNREGISTER when no cached channel exists, avoiding both retained
entries and no-op consumer unregistrations.
The normal REGISTER channel reuse and UNREGISTER cleanup behavior is
unchanged.
### How Did You Test This Change?
Added `testSyncUnregisterWithoutRegister`, which verifies that an unmatched
UNREGISTER does not add an entry to `remoteChannelMap` or call
`ConsumerManager.unregisterConsumer`. The test failed before the product fix
and passes afterward.
Ran the complete `HeartbeatSyncerTest` suite: **5 tests, 0 failures, 0
errors**.
```bash
mvn -pl proxy -am \
-Dtest=HeartbeatSyncerTest \
-Dsurefire.failIfNoSpecifiedTests=false \
-Dnet.bytebuddy.experimental=true test
```
Also ran project Checkstyle successfully across the proxy reactor:
```bash
mvn -pl proxy -am -DskipTests -Denforcer.skip=true validate
```
--
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]