Skip to content

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

Closed
Aias00 wants to merge 2 commits into
apache:developfrom
Aias00:fix/proxy-drop-pop-missing-handle
Closed

[ISSUE #10784] Drop POP messages without receipt handles#10785
Aias00 wants to merge 2 commits 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

codecov-commenter commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.51%. Comparing base (293f588) to head (34e8a66).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10785      +/-   ##
=============================================
- Coverage      48.60%   48.51%   -0.10%     
+ Complexity     13690    13650      -40     
=============================================
  Files           1381     1381              
  Lines         101464   101463       -1     
  Branches       13187    13187              
=============================================
- Hits           49318    49226      -92     
- Misses         46158    46226      +68     
- Partials        5988     6011      +23     

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

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

LGTM. Code changes look good.


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.

Summary

Defensive fix with proper validation and test coverage. LGTM.


Automated review by github-manager-bot

@Aias00

Aias00 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest develop and verified the review request. The regression test uses get(5, TimeUnit.SECONDS), so a stalled pop future fails deterministically rather than hanging CI.

Verified with:

mvn -q -pl proxy -am -Dtest=ConsumerProcessorTest -Dsurefire.failIfNoSpecifiedTests=false test

@Aias00
Aias00 force-pushed the fix/proxy-drop-pop-missing-handle branch from de992d8 to 34e8a66 Compare August 14, 2026 13:24
@Aias00

Aias00 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

Consolidated into #10729; both changes cover ConsumerProcessor POP message handling and diagnostics.

@Aias00 Aias00 closed this Aug 15, 2026
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