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.28%. Comparing base (eddb235) to head (3de7506).
⚠️ Report is 1 commits behind head on develop.

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.34%   48.28%   -0.06%     
+ Complexity     13527    13512      -15     
=============================================
  Files           1380     1380              
  Lines         101104   101141      +37     
  Branches       13107    13122      +15     
=============================================
- Hits           48882    48840      -42     
- Misses         46267    46308      +41     
- Partials        5955     5993      +38     

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

[Bug] Proxy gRPC HeaderInterceptor fails on unresolved socket addresses

3 participants