This is an automated email from the ASF dual-hosted git repository.
lizhimin pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 7f5bf5f893 [ISSUE #8517] Fix client send UNREGISTER_CLIENT request
twice may cause proxy NPE (#8528)
7f5bf5f893 is described below
commit 7f5bf5f89336998d0bfc0b0f468ccbb4ddce90d4
Author: 吴星灿 <[email protected]>
AuthorDate: Tue Aug 13 17:21:11 2024 +0800
[ISSUE #8517] Fix client send UNREGISTER_CLIENT request twice may cause
proxy NPE (#8528)
---
.../remoting/activity/ClientManagerActivity.java | 32 ++++++++++++++--------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git
a/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ClientManagerActivity.java
b/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ClientManagerActivity.java
index c671593a34..05d8e5fbe1 100644
---
a/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ClientManagerActivity.java
+++
b/proxy/src/main/java/org/apache/rocketmq/proxy/remoting/activity/ClientManagerActivity.java
@@ -125,22 +125,30 @@ public class ClientManagerActivity extends
AbstractRemotingActivity {
final String producerGroup = requestHeader.getProducerGroup();
if (producerGroup != null) {
RemotingChannel channel =
this.remotingChannelManager.removeProducerChannel(context, producerGroup,
ctx.channel());
- ClientChannelInfo clientChannelInfo = new ClientChannelInfo(
- channel,
- requestHeader.getClientID(),
- request.getLanguage(),
- request.getVersion());
- this.messagingProcessor.unRegisterProducer(context, producerGroup,
clientChannelInfo);
+ if (channel != null) {
+ ClientChannelInfo clientChannelInfo = new ClientChannelInfo(
+ channel,
+ requestHeader.getClientID(),
+ request.getLanguage(),
+ request.getVersion());
+ this.messagingProcessor.unRegisterProducer(context,
producerGroup, clientChannelInfo);
+ } else {
+ log.warn("unregister producer failed, channel not exist, may
has been removed, producerGroup={}, channel={}", producerGroup, ctx.channel());
+ }
}
final String consumerGroup = requestHeader.getConsumerGroup();
if (consumerGroup != null) {
RemotingChannel channel =
this.remotingChannelManager.removeConsumerChannel(context, consumerGroup,
ctx.channel());
- ClientChannelInfo clientChannelInfo = new ClientChannelInfo(
- channel,
- requestHeader.getClientID(),
- request.getLanguage(),
- request.getVersion());
- this.messagingProcessor.unRegisterConsumer(context, consumerGroup,
clientChannelInfo);
+ if (channel != null) {
+ ClientChannelInfo clientChannelInfo = new ClientChannelInfo(
+ channel,
+ requestHeader.getClientID(),
+ request.getLanguage(),
+ request.getVersion());
+ this.messagingProcessor.unRegisterConsumer(context,
consumerGroup, clientChannelInfo);
+ } else {
+ log.warn("unregister consumer failed, channel not exist, may
has been removed, consumerGroup={}, channel={}", consumerGroup, ctx.channel());
+ }
}
response.setCode(ResponseCode.SUCCESS);
response.setRemark("");