Skip to content

fix(proxy): offline all lite subscriptions and guard empty subscription list - #11149

Open
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/lite-subscription-offline-empty-list
Open

zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/lite-subscription-offline-empty-list

Conversation

@zjncs

@zjncs zjncs commented Sep 11, 2026

Copy link
Copy Markdown

Motivation

GrpcClientSettingsManager.offlineClientLiteSubscription only took subscriptions(0) to build the COMPLETE_REMOVE LiteSubscriptionDTO:

  1. A lite consumer subscribing to multiple topics left stale subscriptions on the broker for every topic after the first one.
  2. When the subscription list was empty, getSubscriptions(0) threw IndexOutOfBoundsException, which the surrounding catch block swallowed — so the cleanup was silently skipped entirely, and the stale lite subscription could trigger LITE_SUBSCRIPTION_QUOTA_EXCEEDED on the next connect.

Modifications

Iterate over all subscription entries and send one COMPLETE_REMOVE per topic; an empty list now simply sends nothing.

Verification

Fail-before (new tests, run against the unpatched code):

Wanted 2 times but was 1 -- GrpcClientSettingsManagerTest#testOfflineClientLiteSubscription_MultipleTopics_AllSubscriptionsRemoved
(multiplex: syncLiteSubscription invoked for only the first of two subscribed topics)

Pass-after:

Tests run: 9, Failures: 0, Errors: 0, Skipped: 0 -- GrpcClientSettingsManagerTest

…on list

offlineClientLiteSubscription only took subscriptions(0) to build the
COMPLETE_REMOVE LiteSubscriptionDTO, so a lite consumer subscribing to
multiple topics left stale subscriptions on the broker for every topic
after the first one. When the subscription list was empty,
getSubscriptions(0) threw IndexOutOfBoundsException which was swallowed
by the catch block, so the cleanup was silently skipped entirely and
the stale lite subscription could trigger LITE_SUBSCRIPTION_QUOTA_EXCEEDED
on the next connect.

Iterate over all subscription entries and send one COMPLETE_REMOVE per
topic; an empty list now simply sends nothing.
Copilot AI lite review requested due to automatic review settings September 11, 2026 07:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Fix offlineClientLiteSubscription to iterate over all subscription entries instead of only processing the first one. Also guards against empty subscription lists.

LGTM — correct fix for multi-topic lite subscription cleanup.


Automated review by github-manager-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants