Merge pull request #12296 from ClickHouse/fix_rare_hanging_in_dnsresolver

Fix rare hanging in DNSResolver
This commit is contained in:
alexey-milovidov 2020-07-09 00:35:07 +03:00 committed by GitHub
commit 1062270580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -269,6 +269,8 @@ bool DNSResolver::updateCache()
LOG_DEBUG(log, "Updating DNS cache");
{
String updated_host_name = Poco::Net::DNS::hostName();
std::lock_guard lock(impl->drop_mutex);
for (const auto & host : impl->new_hosts)
@ -279,7 +281,7 @@ bool DNSResolver::updateCache()
impl->known_addresses.insert(address);
impl->new_addresses.clear();
impl->host_name.emplace(Poco::Net::DNS::hostName());
impl->host_name.emplace(updated_host_name);
}
/// FIXME Updating may take a long time becouse we cannot manage timeouts of getaddrinfo(...) and getnameinfo(...).