Skip to content

Add pluggable DnsNameResolver#2163

Open
doom369 wants to merge 8 commits intoAsyncHttpClient:mainfrom
doom369:main
Open

Add pluggable DnsNameResolver#2163
doom369 wants to merge 8 commits intoAsyncHttpClient:mainfrom
doom369:main

Conversation

@doom369
Copy link
Copy Markdown
Contributor

@doom369 doom369 commented Apr 10, 2026

Fixes #1724. Preserve the previous behaviour + ability to plug own DNS name resolver.

Found it yesterday on our prod server:

576462695-7db52b47-5d27-4cd1-a3e3-f399491a3648 576463467-537e2590-1bc8-424a-b5e2-d5370d3ac24a

Copilot AI and others added 8 commits April 9, 2026 13:36
…up for async DNS

- Add AddressResolverGroup config to AsyncHttpClientConfig interface
- Add field, getter, builder method to DefaultAsyncHttpClientConfig
- ChannelManager creates DnsAddressResolverGroup by default for async DNS with inflight coalescing
- Add AddressResolver-based resolution path in RequestHostnameResolver
- NettyRequestSender uses group resolver when request uses default resolver
- ChannelManager.getBootstrap uses group resolver for SOCKS proxy resolution
- Deprecate RequestBuilderBase.DEFAULT_NAME_RESOLVER (kept as sentinel)

Agent-Logs-Url: https://github.com/doom369/async-http-client/sessions/b442c622-4c82-440d-84d0-50ee30bf3f27

Co-authored-by: doom369 <1536494+doom369@users.noreply.github.com>
…compat

- TransportFactory now provides getDatagramChannelClass() for DNS resolver
- Updated all transport factories (NIO, Epoll, KQueue, IoUring) with datagram channel support
- ChannelManager uses transport-matched datagram channel for DnsAddressResolverGroup
- RequestHostnameResolver wraps DNS errors in UnknownHostException for backward compat

Agent-Logs-Url: https://github.com/doom369/async-http-client/sessions/b442c622-4c82-440d-84d0-50ee30bf3f27

Co-authored-by: doom369 <1536494+doom369@users.noreply.github.com>
…nc DNS

- Remove deprecation from DEFAULT_NAME_RESOLVER (restored to original)
- ChannelManager no longer auto-creates DnsAddressResolverGroup; uses config value or null
- NettyRequestSender checks config.getAddressResolverGroup() instead of identity check
- getBootstrap falls back to per-request NameResolver when no group is configured
- Default behavior is unchanged; users opt-in via setAddressResolverGroup()

Agent-Logs-Url: https://github.com/doom369/async-http-client/sessions/f6e6623f-4edb-4e85-92bf-2b1f44f3c066

Co-authored-by: doom369 <1536494+doom369@users.noreply.github.com>
…solverGroup test

- Revert TransportFactory and all 4 implementations to original state (remove
  getDatagramChannelClass() which is unnecessary since resolver group is user-provided)
- Add AddressResolverGroupTest with 4 test cases covering opt-in async DNS
- Fix javadoc to reflect opt-in (not auto-created) behavior

Agent-Logs-Url: https://github.com/doom369/async-http-client/sessions/dc06458d-dac1-45b3-8e11-c62caeaf3a3d

Co-authored-by: doom369 <1536494+doom369@users.noreply.github.com>
… lazy resolver init

- Added tests for real domains (google.com, example.com) with network
  availability check via assumeTrue
- Made getAddressResolverGroup() a default method returning null in the
  interface to avoid breaking downstream implementations
- Lazily obtain group resolver only in branches that need DNS resolution
- Added fail() to unknownHost test for proper assertion
- Documented resolver group lifecycle ownership in builder Javadoc

Agent-Logs-Url: https://github.com/doom369/async-http-client/sessions/ef98f786-3665-4a5f-9005-60ebdba761b1

Co-authored-by: doom369 <1536494+doom369@users.noreply.github.com>
…Group, simplify error handling

Agent-Logs-Url: https://github.com/doom369/async-http-client/sessions/b617a76d-89c2-45ca-b160-407a5737bcc7

Co-authored-by: doom369 <1536494+doom369@users.noreply.github.com>
Add opt-in AddressResolverGroup support for async DNS resolution
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.

DNS lookups should not block the event loop

2 participants