apache / apache/rocketmq

[Bug] Proxy lite client offline cleanup indexes empty subscriptions

Open Beginner friendly
#10,681 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 searched the existing issues and pull requests.

### Runtime platform environment

All platforms.

### RocketMQ version

develop branch.

### JDK Version

Not applicable.

### Describe the Bug

`GrpcClientSettingsManager.offlineClientLiteSubscription` assumes a lite consumer's cached `Settings` always has at least one subscription entry:

```java
String topic = settings.getSubscription().getSubscriptions(0).getTopic().getName();
String group = settings.getSubscription().getGroup().getName();
```

If a lite consumer has incomplete settings, for example `ClientType.LITE_PUSH_CONSUMER` with no subscription entries, this path throws an `IndexOutOfBoundsException`. The exception is caught by the broad catch block, but the cleanup path then logs an error with the full settings object and skips the offline cleanup through an exceptional path.

### Steps to Reproduce

1. Build `Settings` with `clientType = LITE_PUSH_CONSUMER`.
2. Do not add any subscription entries.
3. Call `GrpcClientSettingsManager.offlineClientLiteSubscription(ctx, clientId, settings)`.
4. The method tries to read `getSubscriptions(0)` before validating the count.

### What Did You Expect to See?

Incomplete or malformed lite-consumer settings should be ignored by the offline cleanup path before indexing into the subscription list. No `IndexOutOfBoundsException` should be needed for control flow.

### What Did You See Instead?

The method relies on the catch block after `getSubscriptions(0)` throws `IndexOutOfBoundsException`, and logs the full settings object at error level.

### Additional Context

This is a small Proxy gRPC runtime cleanup hardening issue. It keeps client disconnect/offline handling from producing noisy error logs for incomplete settings and avoids logging full settings unnecessarily.

Contributor guide

Open the contributing guide

Research direction

Start at GrpcClientSettingsManager.offlineClientLiteSubscription and trace how cached Settings are read during lite-client offline cleanup. Reproduce the case with a LITE_PUSH_CONSUMER that has no subscription entries, then verify incomplete settings are ignored without indexing an empty list, throwing an IndexOutOfBoundsException, or logging the full settings object at error level.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.