[dnsdist] dnsdist-cache-questions

Daniel Stirnimann daniel.stirnimann at switch.ch
Tue Sep 22 09:48:36 UTC 2020

Hello Tom,

On 22.09.20 11:26, Tom via dnsdist wrote:
> When I now want to query the cache via console, I always get the 
> following error:
>  > getPool("bind"):getCache()
> Command returned an object we can't print: Trying to cast a lua variable 
> from "userdata" to 

> Any hints for this?

getCache() returns a PacketCache class. You cannot print the class on
the console but need to do something with it e.g.:

> getPool("bind"):getCache():printStats()

> My 2nd question:
> Assuming the dnsdist-cache is working, has a A-Record-cache-entry for 
> "www.example.com" and dnsdist is in front of a resolver and the resolver 
> (backend) stops working. dnsdist has the record "www.example.com" still 
> in his cache, because only the backend server stops working. Why does 
> dnsdist not answer the query for "www.example.com" from the cache, when 
> the backend server is "down"? Is there a configuration option for this?

>From your previous config snippet it looks like you are already using

staleTTL=60: int - When the backend servers are not reachable, and
global configuration setStaleCacheEntriesTTL is set appropriately, TTL
that will be used when a stale cache entry is returned.

How do you verify that dnsdist is not answering queries from the cache?

Keep in mind that dnsdist caches packets and not responses to DNS
queries. Recent 'dig' versions have EDNS cookies enabled by default.
Each of your queries (packets) will therefore differ. Try 'dig' with


More information about the dnsdist mailing list