Skip to content

[ISSUE #10780] Reject empty cluster batch ack handles - #10781

Open
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-cluster-batch-ack-empty-list
Open

[ISSUE #10780] Reject empty cluster batch ack handles#10781
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-cluster-batch-ack-empty-list

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Reject null or empty handle lists in ClusterMessageService.batchAckMessage() before resolving broker address from the first handle.
  • Return a failed future with INVALID_RECEIPT_HANDLE instead of throwing IndexOutOfBoundsException.
  • Add regression coverage for null and empty handle lists and verify the MQ client is not called.

Fixes #10780.

Verification

mvn -pl proxy -Dtest=ClusterMessageServiceTest test

Result: BUILD SUCCESS. ClusterMessageServiceTest ran 3 tests with 0 failures, errors, or skips. Checkstyle and SpotBugs also passed in the Maven run.

Copilot AI review requested due to automatic review settings August 3, 2026 07:08

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.

Pull request overview

This pull request hardens the Proxy batch-ack path by validating input handle lists up front, preventing runtime exceptions and returning a stable, meaningful failed future (per Issue #10780).

Changes:

  • Add a null/empty guard in ClusterMessageService.batchAckMessage() to avoid IndexOutOfBoundsException when resolving broker address from the first handle.
  • Return a failed future with ProxyExceptionCode.INVALID_RECEIPT_HANDLE for invalid (null/empty) handle lists.
  • Add regression tests for null/empty handle list behavior and assert the MQ client is not invoked.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
proxy/src/main/java/org/apache/rocketmq/proxy/service/message/ClusterMessageService.java Adds early validation for null/empty handle lists and returns a failed future instead of throwing.
proxy/src/test/java/org/apache/rocketmq/proxy/service/message/ClusterMessageServiceTest.java Adds regression coverage for null/empty handle lists and verifies the MQ client is not called.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +162 to +167
if (handleList == null || handleList.isEmpty()) {
return FutureUtils.completeExceptionally(new ProxyException(
ProxyExceptionCode.INVALID_RECEIPT_HANDLE,
"receipt handle list is empty"
));
}

@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.

Review by github-manager-bot

Summary

Adds null/empty guard for in before accessing , returning a failed future with instead of throwing .

Findings

  • [Info] The fix is correct and minimal. Returning a failed (rather than throwing) is consistent with the async contract of this method.
  • [Info] Test coverage is good — both null and empty cases are verified, and confirms no downstream call is made on early rejection.

Suggestions

  • Consider whether the same guard should be applied to (single-handle variant) for consistency, if it does not already have one.

LGTM.


Automated review by github-manager-bot

@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.

Review by github-manager-bot

Summary

Adds null/empty guard for in before accessing , returning a failed future with instead of throwing .

Findings

  • [Info] The fix is correct and minimal. Returning a failed (rather than throwing) is consistent with the async contract of this method.
  • [Info] Test coverage is good — both null and empty cases are verified, and the verification confirms no downstream call is made on early rejection.

Suggestions

  • Consider whether the same guard should be applied to (single-handle variant) for consistency, if it does not already have one.

LGTM.


Automated review by github-manager-bot

@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.

Review by github-manager-bot

Summary

Adds null/empty guard for handleList in ClusterMessageService.batchAckMessage() before accessing handleList.get(0), returning a failed future with INVALID_RECEIPT_HANDLE instead of throwing IndexOutOfBoundsException.

Findings

  • [Info] The fix is correct and minimal. Returning a failed CompletableFuture (rather than throwing) is consistent with the async contract of this method.
  • [Info] Test coverage is good — both null and empty cases are verified, and the never() verification confirms no downstream call is made on early rejection.

Suggestions

  • Consider whether the same guard should be applied to ackMessage() (single-handle variant) for consistency, if it does not already have one.

LGTM.


Automated review by github-manager-bot

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 48.23%. Comparing base (eddb235) to head (2760459).

Files with missing lines Patch % Lines
...q/proxy/service/message/ClusterMessageService.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10781      +/-   ##
=============================================
- Coverage      48.24%   48.23%   -0.01%     
+ Complexity     13496    13490       -6     
=============================================
  Files           1380     1380              
  Lines         101104   101106       +2     
  Branches       13107    13107              
=============================================
- Hits           48773    48767       -6     
- Misses         46350    46357       +7     
- Partials        5981     5982       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

[Bug] ClusterMessageService.batchAckMessage throws on empty handle list

4 participants