SEAKSES · 30+ Global DNS Resolvers, SSL/PKI Suite & Open REST APISpotted a bug or have an idea?
Account

Serve Stale DNS or Fail Fast When an Endpoint Record Goes Blank?

Candra Octavian RamadhaniBy Candra Octavian Ramadhani·2026-12-04T19:12:54+08:00·7 min read
Key Takeaway

When automation publishes an empty or malformed record for a core endpoint, resolvers must choose between answering with expired cached data and returning SERVFAIL to every client. This article explains how serve-stale behavior (RFC 8767) works, when it masks a bad record, and which questions decide the right setting for your resolvers.

When an automation job publishes a broken record for a core endpoint, such as a database hostname, people rarely report it as 'the DNS record is empty.' They report that some services connect fine while others fail with name resolution errors, or that everything looked healthy until a cache expired. Behind that sits a resolver setting. Your recursive resolvers can keep answering with the last known good data, or they can return SERVFAIL so the failure shows up right away. Which one helps depends on what kind of blank you are dealing with, so the walkthrough starts at the client.

Start with what clients actually receive

First, separate what the application reports from what the resolver returns. Application errors like unknown host, Name or service not known, or a connection timeout to an unexpected address look similar in a log, but they come from different DNS outcomes. Query the same recursive resolver your services use, from the same network segment, and look at the status line and the answer section.

Four outcomes are worth telling apart:

  • SERVFAIL means the resolver could not get a usable answer.
  • NXDOMAIN means the name does not exist.
  • NOERROR with an empty answer section, usually called NODATA, means the name exists but has no record of the type you asked for.
  • NOERROR with an address means the resolver returned something. You still need to check whether that address is right and how fresh it is.

Also look at the TTL on the answer. RFC 8767 recommends a TTL of 30 seconds on stale answers, so a small TTL that comes back at the same value on every query is a hint that the resolver is serving stale data. Some resolvers also attach an Extended DNS Error (RFC 8914) with code 3, Stale Answer, which dig prints in the OPT pseudosection when present. Whether yours sends it depends on the software and version.

Before going further, rule out layers that keep their own cache. A local stub resolver like systemd-resolved, a caching daemon like nscd, or a runtime that caches lookups inside the process can hold an old answer long after the recursive resolver changed its answer. If dig against the resolver and the application disagree, the problem sits above the resolver. This confuses support conversations often, because the person testing from a laptop sees a different result than the service that failed.

Ask the authoritative servers directly

Next, bypass recursion and ask each authoritative nameserver for the zone. This shows what the automation actually published, with no cache in between. Replace the addresses and names below with your own.

# What the resolver your services use returns
dig @10.0.0.53 db.internal.example.com A

# What each authoritative server returns, with no recursion
dig @ns1.example.com db.internal.example.com A +norecurse
dig @ns2.example.com db.internal.example.com A +norecurse

Run the direct query against every nameserver in the zone's NS set, not just the first one. Automation that pushes to several servers can leave them disagreeing, and a half-applied change is one way a record ends up blank on only one server. The mechanics of that are covered in how a race condition in authoritative DNS config can publish half-finished records.

The diagnosis comes from comparing what the authoritative servers return with what the resolver returns.

Why serve-stale only covers some kinds of blank

Serve-stale, standardized in RFC 8767, changes one specific rule. Classic DNS says that once a cached record's TTL expires, the resolver must fetch a fresh copy before answering. Under RFC 8767, if the resolver tries to refresh and cannot, it may answer with the expired record instead of failing. The RFC counts a NOERROR or NXDOMAIN response from an authoritative server as a successful refresh. Timeouts, unreachable servers, and other response codes such as SERVFAIL or REFUSED count as a failure to refresh. Only those failures leave the old data available.

That rule splits an automation failure into two cases.

In the first case, the authoritative servers are broken. The zone may have failed to load after a malformed push, so the servers return SERVFAIL, or they may stop responding entirely. Here serve-stale has something to work with. A resolver with serve-stale enabled keeps returning the last good address. A resolver without it returns SERVFAIL once the TTL runs out.

In the second case, the authoritative servers answer cleanly but with bad content, and serve-stale does nothing. An empty answer (NODATA), an NXDOMAIN after the record was deleted, and an A record pointing at a placeholder like 0.0.0.0 are all valid responses. The resolver caches them and hands them to every client. Negative answers are cached for a period derived from the zone's SOA record, as described in RFC 2308. No resolver setting rescues you in this case. The fix belongs in the publishing pipeline.

So when someone says serve-stale saved them during a blank-record incident, or failed to save them, first ask what the authoritative servers were returning.

How serve-stale hides the problem it protects you from

When serve-stale does apply, it makes the outage smaller and harder to see. Clients keep connecting to the old address, error rates stay flat, and dashboards built on application health show nothing wrong. Meanwhile the authoritative side stays broken. You may not find out until the maximum stale period ends, or until a resolver restarts and loses its cache. At that point every client fails at once.

Serve-stale can also hide a second problem. A stale address is only correct while the endpoint still lives there. Database endpoints often move during failover. If the primary changed while the authoritative servers were failing, serve-stale keeps sending clients to the old primary, which may be down or read-only. The errors then show up as connection failures or write errors, and nobody looks at DNS because names still resolve.

Timing matters too. RFC 8767 suggests a client response timer of 1.8 seconds. The resolver tries to refresh, and if it has no fresh answer by then, it answers with stale data while the refresh continues in the background. The RFC also suggests a failure recheck timer of 30 seconds, so the resolver does not keep hammering dead servers, and a maximum stale age of 1 to 3 days. A Technitium DNS Server GitHub issue points out that many HTTP and gRPC clients have connection timeouts of their own, often around 2 seconds. A resolver that waits longer than that before answering stale delivers its answer to a client that has already given up. Both fail fast and serve-stale need short waits, and a resolver that hangs is worse than either. If your lookups stall instead of failing, see tracing the authoritative path when DNS queries hang instead of returning SERVFAIL.

Unbound calls this feature serve-expired, and its documentation on serving stale data describes two modes. With no client timeout set, Unbound answers from expired cache immediately and refreshes in the background, which favors speed. With serve-expired-client-timeout set, it first waits that long for a fresh answer, which is closer to the RFC 8767 behavior. A capped configuration looks like this (the values are an illustrative example):

server:
    serve-expired: yes
    # stop serving expired data one day after it expires (seconds)
    serve-expired-ttl: 86400
    # wait up to 1.8 s for a fresh answer before using stale data (milliseconds)
    serve-expired-client-timeout: 1800

To see the value a running Unbound uses, run unbound-control get_option serve-expired. Defaults for these options have changed across Unbound versions, so check the documentation for your version instead of assuming. BIND 9 has equivalent options (stale-answer-enable, max-stale-ttl, stale-answer-client-timeout), and rndc serve-stale status shows whether the feature is active. Other resolvers use different names, so look up the exact options for the one you run.

Questions that decide the setting

What does your automation produce when it goes wrong? If its failure mode is publishing NODATA or a placeholder address, serve-stale will not help, and the effort belongs in validation before publish. If its failure mode is a zone that will not load, or servers that stop answering, serve-stale buys real time to fix things.

How long does a stale address stay correct? For an endpoint with a stable address behind a load balancer, a day of stale answers is probably harmless. For an endpoint whose IP changes on failover, cap the stale period close to how long you expect a failover to take, or accept fail fast.

Can you see stale answers when they happen? If resolver logs or EDE codes reach your monitoring, serve-stale is a buffer with an alarm attached. If they do not, you are trading a small outage now for a bigger, more confusing one later.

What do your clients do with SERVFAIL? If they retry aggressively without backoff, a fast SERVFAIL across a whole fleet can turn into a storm of lookups against the resolvers. If they fail and degrade cleanly, fail fast is easier to reason about during an incident.

For most teams, the practical middle ground has four parts: serve-stale on, a client timeout under 2 seconds, a capped maximum stale age, and an alert whenever stale answers are served. Then test it on a test zone. Block the resolver from reaching the authoritative servers, and confirm that clients get stale answers with the 30-second TTL or the EDE code. After that, publish a clean NODATA record and confirm it passes straight through to clients, because serve-stale was never designed to cover that case.