This is an automated email from the ASF dual-hosted git repository.
rexxiong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/celeborn.git
The following commit(s) were added to refs/heads/main by this push:
new ac6d1cf5d [CELEBORN-2269] Update Cpp TransportClient to resolve
hostnames via DNS
ac6d1cf5d is described below
commit ac6d1cf5d399618f934bd82983ef9632d278b340
Author: jay.narale <[email protected]>
AuthorDate: Tue Feb 24 13:55:59 2026 +0800
[CELEBORN-2269] Update Cpp TransportClient to resolve hostnames via DNS
### What changes were proposed in this pull request?
This PR changes the folly::SocketAddress constructor calls in
TransportClientFactory::createClient to pass true for the allowNameLookup
parameter. This affects two call sites: the address used as the connection pool
key, and the address used when connecting the bootstrap to the server.
Folly code -
https://github.com/facebook/folly/blob/main/folly/SocketAddress.h#L80
### Why are the changes needed?
Without allowNameLookup = true, folly::SocketAddress only accepts numeric
IP addresses. When a Celeborn worker is addressed by hostnamehe constructor
throws an "invalid address" exception, causing all connections to that worker
to fail.
Setting the parameter to true makes folly::SocketAddress use getaddrinfo,
which transparently handles both hostnames (via DNS resolution) and numeric
IPs. This is safe and backward-compatible since getaddrinfo recognizes numeric
addresses without issuing a DNS query.
### Does this PR resolve a correctness bug?
No.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
CI.
Closes #3609 from jaystarshot/u-c.
Authored-by: jay.narale <[email protected]>
Signed-off-by: Shuang <[email protected]>
---
cpp/celeborn/network/TransportClient.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpp/celeborn/network/TransportClient.cpp
b/cpp/celeborn/network/TransportClient.cpp
index c4b865d1c..0fa531beb 100644
--- a/cpp/celeborn/network/TransportClient.cpp
+++ b/cpp/celeborn/network/TransportClient.cpp
@@ -187,7 +187,7 @@ std::shared_ptr<TransportClient>
TransportClientFactory::createClient(
const std::string& host,
uint16_t port,
int32_t partitionId) {
- auto address = folly::SocketAddress(host, port);
+ auto address = folly::SocketAddress(host, port, true);
auto pool = clientPools_.withLock([&](auto& registry) {
auto iter = registry.find(address);
if (iter != registry.end()) {
@@ -212,7 +212,7 @@ std::shared_ptr<TransportClient>
TransportClientFactory::createClient(
bootstrap->group(clientExecutor_);
bootstrap->pipelineFactory(std::make_shared<MessagePipelineFactory>());
try {
- auto pipeline = bootstrap->connect(folly::SocketAddress(host, port))
+ auto pipeline = bootstrap->connect(folly::SocketAddress(host, port,
true))
.get(rpcLookupTimeout_);
auto dispatcher = std::make_unique<MessageDispatcher>();