Optimistic cache will return stale cache and trigger a background resolve to refresh the cache. Consider following timeline:
receive query -> resolve -> ServFail
receive query -> cache hit and return ServFail
|
-> resolve -> MXDOMAIN -> skip updating cache
If a query always returns MXDOMAIN generally, and somehow upstream returns a ServFail, it will be cached for 30 seconds and then become stale. However, when background retry sees MXDOMAIN, it will skip refresh cache, so all further request will be always responded by a stale cahched ServFail. Clients may retry ServFail and flood adguardhome with meaningless requests.
A simple fix is don't return any stale ServFail response from cache.