Skip to content

fix: harden Proxy Admin route lookup diagnostics - #10773

Open
Aias00 wants to merge 4 commits into
apache:developfrom
Aias00:fix/proxy-admin-skip-malformed-current-broker
Open

fix: harden Proxy Admin route lookup diagnostics#10773
Aias00 wants to merge 4 commits into
apache:developfrom
Aias00:fix/proxy-admin-skip-malformed-current-broker

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Skip malformed current Broker records during Proxy Admin topic operations.
  • Preserve expected not-found handling while surfacing unexpected NameServer route lookup failures.

Validation

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

Closes #10772
Closes #10801

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

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 DefaultAdminService#createTopicOnBroker in the proxy module to tolerate malformed “current broker” route entries, preventing an NPE when current BrokerData rows are missing brokerAddrs.

Changes:

  • Add null checks for brokerData / brokerData.getBrokerAddrs() while collecting current broker master addresses.
  • Skip null master addresses when building the existing broker address set.
  • Add a regression test covering a malformed current broker row with null broker addresses.

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/admin/DefaultAdminService.java Skips malformed current broker entries when collecting existing broker addresses to avoid NPE.
proxy/src/test/java/org/apache/rocketmq/proxy/service/admin/DefaultAdminServiceTest.java Adds regression coverage ensuring topic creation proceeds even with malformed current broker data.

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

Comment on lines +110 to +112
assertEquals("127.0.0.1:10911", addrArgumentCaptor.getValue());
assertEquals("createTopic", topicConfigArgumentCaptor.getValue().getTopicName());
}
@codecov-commenter

codecov-commenter commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.55556% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.50%. Comparing base (293f588) to head (b7652d8).

Files with missing lines Patch % Lines
...ketmq/proxy/service/admin/DefaultAdminService.java 55.55% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10773      +/-   ##
=============================================
- Coverage      48.62%   48.50%   -0.13%     
+ Complexity     13692    13653      -39     
=============================================
  Files           1381     1381              
  Lines         101464   101470       +6     
  Branches       13187    13190       +3     
=============================================
- Hits           49337    49213     -124     
- Misses         46142    46242     +100     
- Partials        5985     6015      +30     

☔ 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/empty guards in DefaultProducerAssignor.assign() for brokerData and brokerData.getBrokerAddrs() before accessing the master address, preventing NullPointerException when broker metadata is missing or incomplete.

Findings

  • [Info] The fix correctly handles three failure modes: null brokerData, null brokerAddrs map, and null master address. Each is skipped without throwing.
  • [Info] Test coverage is thorough — testAssignWithMalformedBrokerData verifies the FORBIDDEN result when broker data is null, and testAssignWithNullMasterAddress verifies handling of missing master address.

Suggestions

  • None. Clean defensive fix with proper test coverage.

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.

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 changed the title [ISSUE #10772] Skip malformed current broker data fix: harden Proxy Admin route lookup diagnostics Aug 15, 2026
@Aias00
Aias00 force-pushed the fix/proxy-admin-skip-malformed-current-broker branch from 14fd55a to b7652d8 Compare August 15, 2026 07:38
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 admin topicExist hides non-not-found route lookup errors [Bug] Proxy DefaultAdminService can NPE on malformed current broker data

4 participants