Skip to content

HDDS-17195. Ozone RPC client ignores ipc.client.bind.wildcard.addr when binding to the Kerberos principal host - #11681

Merged
smengcl merged 5 commits into
apache:masterfrom
smengcl:HDDS-17195
Oct 30, 2026
Merged

smengcl merged 5 commits into
apache:masterfrom
smengcl:HDDS-17195

Conversation

@smengcl

@smengcl smengcl commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5), Codex (GPT-6)

What changes were proposed in this pull request?

Ozone carries its own copy of the Hadoop RPC client (org.apache.hadoop.ipc_.Client). In secure mode, when the protocol has @KerberosInfo, Connection.setupConnection binds the client socket to the local address of the host in the caller's Kerberos principal before connecting.

Hadoop lets operators turn that off with ipc.client.bind.wildcard.addr=true. Ozone's copy reads the flag into bindToWildCardAddress and computes bindTo, but then binds to localAddr anyway, so the flag has no effect.

On a dual stack host this breaks service to service RPC (OM to SCM, datanode to SCM, SCM to SCM) when the target is configured with an IPv6 literal: the principal's host name resolves to IPv4 first, so the socket is bound to an IPv4 address and then connects to an IPv6 address. The reverse combination fails the same way.

This change binds the socket to the existing bindTo variable, which is null (wildcard) when the flag is set. Upstream Hadoop calls NetUtils.bindToLocalAddress for this, but that method is missing in Hadoop 2, and the Ozone filesystem jar for Hadoop 2 uses the Hadoop 2 NetUtils at runtime. With the default (false), behavior is unchanged.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-17195

How was this patch tested?

Added TestClient.testKerberosSocketBinding, which runs the real connection setup with a mocked socket and Kerberos identity for both values of ipc.client.bind.wildcard.addr. Without the fix, the true case fails. Checkstyle passes locally. CI.

🤖 Generated with Claude Code

…en binding to the Kerberos principal host

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 22, 2026 07:48

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jojochuang

Copy link
Copy Markdown
Contributor

@smengcl I added a test-only regression commit on top of this PR: jojochuang@e8ec942

Branch: jojochuang:codex/HDDS-17195-bind-test. Feel free to cherry-pick the commit.

TestClient.testKerberosSocketBinding exercises the actual RPC connection setup with a mocked socket and Kerberos identity for both values of ipc.client.bind.wildcard.addr. It verifies wildcard versus explicit local binding, ephemeral local port, and an unchanged remote destination. It needs no KDC or network connection and makes no production-code changes.

Confirmed regression: restoring the original line makes the true case fail (it binds to loopback rather than wildcard), while false passes. With this PR's fix, both cases pass (about one second). Checkstyle and the hdds-common RAT check also pass on JDK 21.

Generated-by: Codex (GPT-6)

Co-authored-by: Codex (GPT-6)
Change-Id: I6c11c3eb1d588d236a3e47116c0e3bb5f227cf1e
@smengcl

smengcl commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

@jojochuang Thanks for the test!

@jojochuang
jojochuang marked this pull request as ready for review October 25, 2026 18:01
@jojochuang

Copy link
Copy Markdown
Contributor

I triggered CI 3 times, all ended up time out after 2.5 hr.

@smengcl

smengcl commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

I triggered CI 3 times, all ended up time out after 2.5 hr.

Looks to be the change breaking ozone client on Hadoop 2. let me check

@smengcl
smengcl marked this pull request as draft October 29, 2026 18:29
smengcl and others added 2 commits October 29, 2026 11:29
…ress

NetUtils.bindToLocalAddress does not exist in Hadoop 2, which the Ozone
filesystem jar for Hadoop 2 uses at runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@smengcl
smengcl marked this pull request as ready for review October 29, 2026 22:31
@smengcl
smengcl merged commit c337e70 into apache:master Oct 30, 2026
134 checks passed
@smengcl

smengcl commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @jojochuang for the review.

@smengcl
smengcl deleted the HDDS-17195 branch October 30, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants