Files
coredns/plugin
Ahmad Mehrabi 16b53a46c1 plugin/cache: cache SERVFAIL when the resolver fails without a response (#8629)
* plugin/cache: cache SERVFAIL when the resolver fails without a response

The forward plugin returns (SERVFAIL, err) on an upstream timeout without
calling WriteMsg, so the response never reaches the cache ResponseWriter
and is not stored. Every client retry then hits the upstream again and
pays the full forward timeout, while a SERVFAIL sent by the upstream is
cached normally.

Store a SERVFAIL generated from the failure, bounded by the existing
servfail TTL, so identical queries are answered from the cache while it is
valid. A servfail TTL of 0 keeps the previous behaviour.

Signed-off-by: Ahmad Mehrabi <mehrabi@post.com>

* plugin/cache: do not cache SERVFAIL caused by a canceled request

forward also returns SERVFAIL together with an error when the request
context is canceled. DoH propagates the HTTP request context, so caching
that failure would make every subsequent request with the same cache key
fail until the servfail TTL expires, even though the upstream is healthy.

Only insert the synthetic SERVFAIL when the request context is still live,
and add a regression test that cancels the first request and then verifies
that a subsequent healthy request reaches the backend.

Signed-off-by: Ahmad Mehrabi <mehrabi@post.com>

---------

Signed-off-by: Ahmad Mehrabi <mehrabi@post.com>
2026-10-15 19:29:41 -07:00
..
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2026-10-08 10:21:06 +02:00
2019-08-24 18:14:25 +00:00
2018-07-19 16:23:06 +01:00
2020-09-24 18:14:41 +02:00