Skip to content

Commit

Permalink
Fix logging in socket.cpp (pytorch#137745)
Browse files Browse the repository at this point in the history
Formatter shall avoid throwing exceptions as much as possible.

Fixes pytorch#128673 (comment)

Pull Request resolved: pytorch#137745
Approved by: https://github.com/d4l3k, https://github.com/Skylion007
  • Loading branch information
ppwwyyxx authored and pytorchmergebot committed Oct 13, 2024
1 parent fe8d66d commit 08576b2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions torch/csrc/distributed/c10d/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,7 @@ std::string formatSockAddr(const struct ::sockaddr* addr, socklen_t len) {
return fmt::format("[{}]:{}", ip, psai->sin6_port);
}
}

C10_THROW_ERROR(
DistNetworkError,
fmt::format(
"failed to format addr, unknown family={}", addr->sa_family));
return "?UNKNOWN?";
}
if (addr->sa_family == AF_INET) {
return fmt::format("{}:{}", host, port);
Expand Down

0 comments on commit 08576b2

Please sign in to comment.