Skip to content

Fail fast on empty round-robin address resolution#2254

Merged
hyperxpro merged 1 commit into
mainfrom
fix/round-robin-empty-resolved-addresses
Jul 18, 2026
Merged

Fail fast on empty round-robin address resolution#2254
hyperxpro merged 1 commit into
mainfrom
fix/round-robin-empty-resolved-addresses

Conversation

@hyperxpro

Copy link
Copy Markdown
Member

Motivation:

PR #2229 changed round-robin mode to schedule the request timeout only once. As part of that change, the new-connection path assumes a successful DNS resolution always returns at least one address and unconditionally accesses the first entry. If a custom NameResolver incorrectly reports success with an empty address list, this results in an IndexOutOfBoundsException that is swallowed by Netty, leaving the request future incomplete and no request timeout scheduled. The request then hangs until the caller's own timeout expires.

Modification:

Guard the round-robin new-connection path against an empty resolved address list. If resolution succeeds with no addresses, fail the request immediately with an UnknownHostException containing the requested host instead of indexing into the list. Add a test covering a custom resolver that returns an empty successful result and verify the request fails fast instead of hanging.

Result:

Round-robin requests now fail fast with a clear UnknownHostException when a resolver returns an empty address list, avoiding a swallowed exception and a hung request. Existing behavior for valid resolvers and DEFAULT mode is unchanged.

@hyperxpro
hyperxpro force-pushed the fix/round-robin-empty-resolved-addresses branch from 3d4827e to d681658 Compare July 18, 2026 21:10
@hyperxpro
hyperxpro merged commit 76ebaba into main Jul 18, 2026
17 checks passed
@hyperxpro
hyperxpro deleted the fix/round-robin-empty-resolved-addresses branch July 18, 2026 21:18
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.

1 participant