Skip to content

[ISSUE #10784] Drop POP messages without receipt handles - #10785

Open
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-drop-pop-missing-handle
Open

[ISSUE #10784] Drop POP messages without receipt handles#10785
Aias00 wants to merge 1 commit into
apache:developfrom
Aias00:fix/proxy-drop-pop-missing-handle

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What is changed

  • Avoid returning POP messages when the broker response does not contain a receipt handle.
  • Keep the existing invalid-response diagnostic log but skip the message before result filtering and client delivery.
  • Add ConsumerProcessorTest coverage to verify missing-handle messages are dropped and not passed to the POP result filter.

Fixes #10784

Verification

  • mvn -pl proxy -Dtest=ConsumerProcessorTest test

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

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

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

This PR fixes handling of malformed POP responses by dropping messages that lack a receipt handle, preventing invalid messages from reaching filtering and clients.

Changes:

  • Skip POP messages when the broker response does not include a receipt handle.
  • Add a unit test to ensure missing-handle messages are dropped and the POP result filter 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/processor/ConsumerProcessor.java Stops adding messages with missing receipt handles into the returned POP result.
proxy/src/test/java/org/apache/rocketmq/proxy/processor/ConsumerProcessorTest.java Adds coverage verifying missing-handle messages are dropped and not passed to the result filter.

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

Comment on lines +180 to +194
PopResult popResult = this.consumerProcessor.popMessage(
createContext(),
(ctx, messageQueueView) -> mock(AddressableMessageQueue.class),
CONSUMER_GROUP,
TOPIC,
60,
invisibleTime,
Duration.ofSeconds(3).toMillis(),
ConsumeInitMode.MAX,
FilterAPI.build(TOPIC, "*", ExpressionType.TAG),
false,
popMessageResultFilter,
null,
Duration.ofSeconds(3).toMillis()
).get();

@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

Fixes a bug in ConsumerProcessor.processRequest() where POP messages without receipt handles were still being added to the result list despite being logged as [BUG]. Now such messages are properly dropped.

Findings

  • [Info] ConsumerProcessor.java:218 — Removing messageExtList.add(messageExt) from the null-handle branch is the correct fix. The original code logged a bug but still delivered the message, which could cause downstream issues for consumers.
  • [Info] Test testProcessRequest_NullReceiptHandle_DropsMessage correctly verifies that messages without handles are excluded from the response.
  • [Info] The fix is minimal and focused — no unnecessary changes.

Suggestions

  • None. Clean, targeted bug fix.

LGTM — correct fix for a clear bug where invalid messages were being delivered to consumers.


Automated review by github-manager-bot

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.23%. Comparing base (eddb235) to head (5588873).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10785      +/-   ##
=============================================
- Coverage      48.24%   48.23%   -0.01%     
+ Complexity     13496    13489       -7     
=============================================
  Files           1380     1380              
  Lines         101104   101103       -1     
  Branches       13107    13107              
=============================================
- Hits           48773    48763      -10     
- Misses         46350    46358       +8     
- 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.

Proxy should not return POP messages without receipt handles

4 participants