Skip to content

Commit c0ba291

Browse files
committed
Create Bootstrap with unresolved address
This forces the Netty client use InetAddress.getByName/getAllByName for each connect() request, which will delegate to the JVM's DNS lookup and caching mechanism
1 parent 5d4c3a0 commit c0ba291

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "bugfix",
3+
"category": "Netty NIO HTTP Client",
4+
"description": "Fix issue where DNS resolution for a host is only made once for the initial request to the host. If the DNS entries change for a hostname, the client will resolve the new address until the client is closed and recreated."
5+
}

http-clients/netty-nio-client/src/main/java/software/amazon/awssdk/http/nio/netty/internal/AwaitCloseChannelPoolMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private Bootstrap createBootstrap(URI poolKey) {
178178
.channelFactory(sdkEventLoopGroup.channelFactory())
179179
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, configuration.connectTimeoutMillis())
180180
// TODO run some performance tests with and without this.
181-
.remoteAddress(new InetSocketAddress(host, port));
181+
.remoteAddress(InetSocketAddress.createUnresolved(host, port));
182182
sdkChannelOptions.channelOptions().forEach(bootstrap::option);
183183

184184
return bootstrap;

0 commit comments

Comments
 (0)