Skip to content

fix: bracket resolved IPv6 hostnames in Artery settings - #3809

Merged
He-Pin merged 1 commit into
apache:mainfrom
He-Pin:hepin/artery-resolved-ipv6-hostname
Nov 26, 2026
Merged

He-Pin merged 1 commit into
apache:mainfrom
He-Pin:hepin/artery-resolved-ipv6-hostname

Conversation

@He-Pin

@He-Pin He-Pin commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Motivation

Artery's <getHostAddress> setting can resolve to an IPv6 literal. That result skipped the existing normalization for explicitly configured IPv6 addresses.

Modification

Apply the existing IPv6 bracket rule after resolving the hostname setting, for both canonical and explicit bind hostnames. Keep DNS names, IPv4 addresses and already bracketed literals unchanged. This revision leaves the production change as previously reviewed and adds coverage for a numeric IPv6 scope ID and an IPv6 literal returned by <getHostName>, without requiring a real network interface or reverse DNS.

Result

A resolved numeric IPv6 hostname can be used in an advertised Pekko address and parsed back. The docs now name both <getHostAddress> and <getHostName>. The settings tests pin both cases deterministically.

Risk

The change is limited to hostname normalization in Artery settings. No change to the transport lookup API or new requirements for address resolution.

Tests

The original IPv6 settings regression failed on the baseline with the same test seam and passed with the fix. With this revision, all 11 ArterySettingsSpec cases passed in native JDK 17 runs on both Scala 2.13.18 and 3.3.9. Scoped Scala formatting and header checks passed. Local Paradox stopped at Maven dependency access; hosted documentation CI is pending. Full build, MiMa and live TCP/Aeron IPv6 were not run locally.

Reference

Related Netty formatting precedent: netty/netty#14141

@He-Pin
He-Pin marked this pull request as ready for review November 24, 2026 03:45
@He-Pin
He-Pin requested a review from pjfanning November 25, 2026 03:47

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct to me. I checked that an unbracketed resolved literal such as 0:0:0:0:0:0:0:1 gives host=null, port=-1 when the pekko://sys@host:port URI is parsed, so the bug is real, and that the bracketed form is accepted by both java.net.URI and InetSocketAddress (and is what the Aeron endpoint= channel string needs). InetAddress.getLocalHost is still only evaluated for the two placeholder values, so nothing changes for explicitly configured hostnames.

A few optional nits inline, none blocking.

Motivation:
Explicitly configured IPv6 literals were bracketed, but a local-address
placeholder could bypass normalization and leave a canonical address
without the brackets separating its host from its port.

Modification:
Normalize hostnames after resolving either placeholder. Leave IPv4, DNS
names and already bracketed IPv6 literals unchanged. Cover numeric
scoped addresses and pre-named IPv6 literals without an interface or
name lookup, and document both placeholders.

Result:
Resolved and explicitly configured IPv6 literals use the same Artery
hostname representation and preserve a numeric scope where present.

Tests:
- JDK 17: native ArterySettingsSpec passed 11/11 each on Scala 2.13.18
  and Scala 3.3.9. Scoped license headers passed.
- Scoped OrganizeImports, Scala formatting and git diff --check passed.

References:
Refs apache#3809. Informed by Netty #14141; no source code copied.
@He-Pin
He-Pin force-pushed the hepin/artery-resolved-ipv6-hostname branch from ec780ab to ebfb43c Compare November 26, 2026 09:16

@pjfanning pjfanning left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the scoped link-local and <getHostName> tests and updating the docs. LGTM.

@He-Pin
He-Pin merged commit 2c35424 into apache:main Nov 26, 2026
11 checks passed
@He-Pin
He-Pin deleted the hepin/artery-resolved-ipv6-hostname branch November 26, 2026 18:52
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.

2 participants