Skip to content

[ISSUE #10799] Tolerate unresolved gRPC peer addresses - #10800

Open
Aias00 wants to merge 2 commits into
apache:developfrom
Aias00:fix/proxy-header-interceptor-unresolved-10799
Open

[ISSUE #10799] Tolerate unresolved gRPC peer addresses#10800
Aias00 wants to merge 2 commits into
apache:developfrom
Aias00:fix/proxy-header-interceptor-unresolved-10799

Conversation

@Aias00

@Aias00 Aias00 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • avoid NPE when HeaderInterceptor receives unresolved InetSocketAddress values
  • fall back to getHostString() while preserving host:port formatting
  • add a regression test for unresolved remote and local peer addresses

Fixes #10799

Tests

  • mvn -pl proxy -Dtest=HeaderInterceptorTest test
  • git diff --check

Copilot AI review requested due to automatic review settings August 3, 2026 15:13

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.

Adds resilience in HeaderInterceptor when gRPC provides unresolved InetSocketAddress values, preventing NPEs and preserving host:port formatting, with a regression test to cover this case.

Changes:

  • Update socket address parsing to gracefully handle unresolved InetSocketAddress via getHostString().
  • Add regression test verifying remote/local unresolved peer addresses are written into headers.

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/grpc/interceptor/HeaderInterceptor.java Avoids NPE by using getHostString() when InetSocketAddress#getAddress() is null; keeps host:port output.
proxy/src/test/java/org/apache/rocketmq/proxy/grpc/interceptor/HeaderInterceptorTest.java Adds coverage for unresolved remote/local transport addresses being propagated into metadata.

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

Comment on lines +88 to +90
public MethodDescriptor<String, String> getMethodDescriptor() {
return null;
}
@codecov-commenter

codecov-commenter commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.51%. Comparing base (293f588) to head (036e7c6).

Files with missing lines Patch % Lines
...etmq/proxy/grpc/interceptor/HeaderInterceptor.java 40.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10800      +/-   ##
=============================================
- Coverage      48.60%   48.51%   -0.10%     
+ Complexity     13690    13656      -34     
=============================================
  Files           1381     1381              
  Lines         101464   101467       +3     
  Branches       13187    13189       +2     
=============================================
- Hits           49318    49227      -91     
- Misses         46158    46215      +57     
- Partials        5988     6025      +37     

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

Summary

Adds defensive handling for unresolved gRPC peer addresses, preventing NPE/IAE when peer address resolution fails. Good defensive coding with proper fallback behavior.

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 — defensive improvement with proper error handling and test coverage.


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 current develop and revalidated HeaderInterceptorTest. The refreshed branch will rerun the prior Windows/macOS compile failures.

@Aias00
Aias00 force-pushed the fix/proxy-header-interceptor-unresolved-10799 branch from 3de7506 to 036e7c6 Compare August 14, 2026 13:02
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 HeaderInterceptor fails on unresolved socket addresses

4 participants