apache / apache/rocketmq

[Bug] Proxy gRPC HeaderInterceptor fails on unresolved socket addresses

Open Beginner friendly
#10,799 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

### Before Creating the Bug Report

- [x] I found a bug, not just asking a question, which should be created in GitHub Issues.
- [x] I have searched the existing issues and believe this is not a duplicate.
- [x] I have confirmed that this bug belongs to the current repository.

### Describe the Bug

`HeaderInterceptor#parseSocketAddress` assumes that every `InetSocketAddress` has a resolved `InetAddress`:

```java
inetSocketAddress.getAddress().getHostAddress()
```

For unresolved socket addresses, `InetSocketAddress#getAddress()` returns `null`. In that case the gRPC header interceptor throws a `NullPointerException` while parsing the remote or local address, interrupting request handling before the call reaches the next handler.

### Expected Behavior

The interceptor should tolerate unresolved addresses and still preserve useful diagnostics. It can use `InetSocketAddress#getHostString()` as a fallback and keep formatting the address as `host:port`.

### Scope

RocketMQ Studio Track 2 / Proxy gRPC runtime diagnostics and admin-facing connection metadata. This is a small defensive fix in the Proxy gRPC interceptor path.

### Proposed Fix

Update `parseSocketAddress` to use the resolved host address when available, otherwise fall back to `getHostString()`. Add a regression test covering unresolved remote/local socket addresses.

Contributor guide

Open the contributing guide

Research direction

Start by locating HeaderInterceptor#parseSocketAddress and read how the Proxy gRPC interceptor parses remote and local InetSocketAddress values. Add a regression test for unresolved addresses, then run the relevant interceptor tests. Done means request handling no longer throws a NullPointerException and diagnostics retain host:port formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, java
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.