apache / apache/rocketmq

[Bug] Repeated subscription changed logs for unchanged gRPC subscriptions

Open
#10,541 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

### Before Creating the Bug Report

- [x] I have confirmed this issue has not been reported before.
- [x] I have searched the existing issues.

### Runtime platform environment

RocketMQ proxy with gRPC consumers and proxy heartbeat sync enabled.

### RocketMQ version

develop branch

### Describe the Bug

For gRPC consumers, `ClientActivity.registerConsumer()` rebuilds the subscription data set from the client `Settings` on each registration/heartbeat path. `FilterAPI.build()` creates a new `SubscriptionData`, whose default `subVersion` is initialized with `System.currentTimeMillis()`.

When the subscription topic and filter expression are unchanged, the newly built `SubscriptionData` still has a newer `subVersion`. `ConsumerGroupInfo.updateSubscription()` currently logs `subscription changed` whenever the incoming `subVersion` is greater than the stored one, so the broker/proxy can repeatedly log subscription changes even though the subscription content is identical.

This is especially visible on the proxy internal heartbeat sync path, where the log thread can be `HeartbeatSyncer`.

### Steps to Reproduce

1. Start RocketMQ proxy in cluster mode.
2. Register a gRPC consumer with a stable subscription.
3. Let the client continue sending heartbeat/settings updates or let proxy heartbeat sync propagate the registration data.
4. Observe repeated `subscription changed` logs with identical topic/filter content but different `subVersion` values.

### What Did You Expect to See?

The broker/proxy should only log `subscription changed` when the actual subscription content changes.

### What Did You See Instead?

The log is printed repeatedly because only `subVersion` changes.

### Additional Context

The repeated log is mostly noise and internal sync overhead, but it can make operational logs misleading and noisy for stable gRPC consumers.

Contributor guide

Open the contributing guide

Research direction

Start by reading ClientActivity.registerConsumer(), FilterAPI.build(), and ConsumerGroupInfo.updateSubscription() to trace how subscription data and subVersion move through registration and heartbeat sync. Reproduce the proxy cluster scenario with a stable gRPC subscription, then verify that unchanged topic and filter content no longer produces repeated subscription-changed logs while real content changes still do.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.