Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: only cache successfult record #22019

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/yb/util/net/dns_resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,12 @@ class DnsResolver::Impl {
const Resolver::results_type& entries) mutable {
// Unfortunately there is no safe way to set promise value from 2 different threads, w/o
// catching exception in case of concurrency.
SetResult(PickResolvedAddress(host, error, entries), promise.get());
if (error == boost::system::error_code()) {
//only cache successful record in case of udp packet lost
SetResult(PickResolvedAddress(host, error, entries), promise.get());
} else {
LOG(WARNING) << "resolve failed: host " << host << ", " << "err " << error.message();
}
});

if (io_service->stopped()) {
Expand Down