Skip to content

fix: harden gRPC route and assignment Broker validation - #10771

Open
Aias00 wants to merge 2 commits into
apache:developfrom
Aias00:fix/proxy-query-assignment-missing-master
Open

fix: harden gRPC route and assignment Broker validation#10771
Aias00 wants to merge 2 commits into
apache:developfrom
Aias00:fix/proxy-query-assignment-missing-master

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Skip invalid route entries that lack Broker data while retaining valid queues during gRPC route lookup.
  • Reject assignment responses safely when no master Broker is available.

Validation

mvn -q -pl proxy -am -Dtest=RouteActivityTest -DfailIfNoTests=false test

Closes #10770
Closes #10768

Copilot AI review requested due to automatic review settings August 3, 2026 06:40

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 PR hardens Proxy gRPC RouteActivity#queryAssignment against malformed/partial route metadata by skipping queue rows that don’t have a master broker entry, avoiding exceptional failures during protobuf MessageQueue construction and instead returning the existing controlled FORBIDDEN response when no valid assignments remain.

Changes:

  • Skip queue rows where brokerIdMap.get(MixAll.MASTER_ID) returns null in RouteActivity#queryAssignment.
  • Add a regression test covering route metadata that only contains non-master broker IDs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
proxy/src/main/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivity.java Skips queue rows lacking a master broker to prevent null broker usage when building assignments.
proxy/src/test/java/org/apache/rocketmq/proxy/grpc/v2/route/RouteActivityTest.java Adds coverage for the “missing master broker” route-metadata scenario, asserting a controlled FORBIDDEN response with no assignments.

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

@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 (2530042).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10771      +/-   ##
=============================================
- Coverage      48.62%   48.51%   -0.11%     
+ Complexity     13692    13654      -38     
=============================================
  Files           1381     1381              
  Lines         101464   101466       +2     
  Branches       13187    13188       +1     
=============================================
- Hits           49337    49228     -109     
- Misses         46142    46226      +84     
- Partials        5985     6012      +27     

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

Review by github-manager-bot

Summary

Adds null check for broker after brokerIdMap.get(MixAll.MASTER_ID) in DefaultConsumerAssignor.queryAssignment(), preventing NullPointerException when the master broker is missing from the route result.

Findings

  • [Info] The fix is correct and minimal. Returning a FORBIDDEN result when the master broker is unavailable is the right behavior — the client should not proceed with assignment from an incomplete route.
  • [Info] Test coverage verifies that a missing master broker results in FORBIDDEN with no assignments.

Suggestions

  • None. Clean, targeted fix.

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.

Summary

Defensive fix with proper validation and test coverage. LGTM.


Automated review by github-manager-bot

@Aias00 Aias00 changed the title [ISSUE #10770] Skip queryAssignment queues without master broker fix: harden gRPC route and assignment Broker validation Aug 15, 2026
@Aias00
Aias00 force-pushed the fix/proxy-query-assignment-missing-master branch from 609f468 to 2530042 Compare August 15, 2026 07:40
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] Proxy gRPC queryAssignment can set a null master broker [Bug] Proxy gRPC queryRoute stops processing queues after a missing broker entry

4 participants