[GH-ISSUE #922] ResolverOpts: Disable caching is ignored in 0.18.0-alpha.1 #566

Open
opened 2026-03-15 23:11:56 +03:00 by kerem · 3 comments
Owner

Originally created by @ivanceras on GitHub (Nov 15, 2019).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/922

Describe the bug
The api just keeps returning the same set of txt_records, excluding the new ones I have just added, even though I can see that it has been propagated using tools like: https://mxtoolbox.com/

To Reproduce
I have this config to lookup for the txt_record of a domain.

    let mut resolver_opts = ResolverOpts::default();
    resolver_opts.cache_size = 0;
    resolver_opts.use_hosts_file = false;
    resolver_opts.validate = true;

I also tried using the default ResolverOpts only, but still has the same results.

If it's relevant I use my own supplied IP addresses which is the same provided by the IP.
I have a plan to add different IP's in the future.

const CLOUDFLARE: &str = "1.1.1.1";
const GOOGLE: &str = "8.8.8.8";
const QUAD9: &str = "9.9.9.9";
const GOOGLE_ALT: &str = "8.8.4.4";

lazy_static::lazy_static! {
    pub static ref IP_STRS: [&'static str; 4] = [GOOGLE, CLOUDFLARE, QUAD9, GOOGLE_ALT];
    pub static ref DNS_IP: Vec<IpAddr> = IP_STRS.into_iter().map(|ip| IpAddr::V4(ip.parse().unwrap())).collect();
}

    let mut resolver_opts = ResolverOpts::default();
    resolver_opts.cache_size = 0;
    resolver_opts.use_hosts_file = false;
    resolver_opts.validate = true;
    let (resolver, bg_future) = AsyncResolver::new(
        ResolverConfig::from_parts(None, vec![], NameServerConfigGroup::from_ips_clear(&DNS_IP, 53)),
        resolver_opts,
    );
    tokio::spawn(bg_future);
    let result = resolver.txt_lookup(domain).await?;
    Ok(result.into_iter().collect())

Expected behavior
If I keep calling the api to return the TXT_RECORD, before and after my newly added TXT_RECORD, it should somehow pull from the DNS servers instead of keep returning the same set cached txt_records.

System:

  • OS: [e.g. macOS]
  • Architecture: [e.g. x86_64]
  • Version [e.g. 22]
  • rustc version: [e.g. 1.28]

Version:
Crate: resolver
Version: 0.18.0-alpha.1

Additional context
I tried out the new version because of the new async/await syntax, but it has some caching issues.

Originally created by @ivanceras on GitHub (Nov 15, 2019). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/922 **Describe the bug** The api just keeps returning the same set of txt_records, excluding the new ones I have just added, even though I can see that it has been propagated using tools like: https://mxtoolbox.com/ **To Reproduce** I have this config to lookup for the `txt_record` of a domain. ```rust let mut resolver_opts = ResolverOpts::default(); resolver_opts.cache_size = 0; resolver_opts.use_hosts_file = false; resolver_opts.validate = true; ``` I also tried using the default ResolverOpts only, but still has the same results. If it's relevant I use my own supplied IP addresses which is the same provided by the IP. I have a plan to add different IP's in the future. ```rust const CLOUDFLARE: &str = "1.1.1.1"; const GOOGLE: &str = "8.8.8.8"; const QUAD9: &str = "9.9.9.9"; const GOOGLE_ALT: &str = "8.8.4.4"; lazy_static::lazy_static! { pub static ref IP_STRS: [&'static str; 4] = [GOOGLE, CLOUDFLARE, QUAD9, GOOGLE_ALT]; pub static ref DNS_IP: Vec<IpAddr> = IP_STRS.into_iter().map(|ip| IpAddr::V4(ip.parse().unwrap())).collect(); } let mut resolver_opts = ResolverOpts::default(); resolver_opts.cache_size = 0; resolver_opts.use_hosts_file = false; resolver_opts.validate = true; let (resolver, bg_future) = AsyncResolver::new( ResolverConfig::from_parts(None, vec![], NameServerConfigGroup::from_ips_clear(&DNS_IP, 53)), resolver_opts, ); tokio::spawn(bg_future); let result = resolver.txt_lookup(domain).await?; Ok(result.into_iter().collect()) ``` **Expected behavior** If I keep calling the api to return the TXT_RECORD, before and after my newly added TXT_RECORD, it should somehow pull from the DNS servers instead of keep returning the same set `cached` txt_records. **System:** - OS: [e.g. macOS] - Architecture: [e.g. x86_64] - Version [e.g. 22] - rustc version: [e.g. 1.28] **Version:** Crate: resolver Version: 0.18.0-alpha.1 **Additional context** I tried out the new version because of the new `async/await` syntax, but it has some caching issues.
Author
Owner

@bluejekyll commented on GitHub (Nov 15, 2019):

What is the TTL on the TXT records? We have a lot of tests around the caching, but if the TTL is high, we will cache it for that period of time.

<!-- gh-comment-id:554433648 --> @bluejekyll commented on GitHub (Nov 15, 2019): What is the TTL on the TXT records? We have a lot of tests around the caching, but if the TTL is high, we will cache it for that period of time.
Author
Owner

@ivanceras commented on GitHub (Nov 16, 2019):

Oh, I missed out that detail. I always put 1 minute on the TTL everytime I put a TXT record.

<!-- gh-comment-id:554591571 --> @ivanceras commented on GitHub (Nov 16, 2019): Oh, I missed out that detail. I always put 1 minute on the TTL everytime I put a TXT record.
Author
Owner

@bluejekyll commented on GitHub (Nov 16, 2019):

Ok, thanks for the report. I'll have to review the tests to try and see if there is something that's amiss.

<!-- gh-comment-id:554607065 --> @bluejekyll commented on GitHub (Nov 16, 2019): Ok, thanks for the report. I'll have to review the tests to try and see if there is something that's amiss.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#566
No description provided.