unbound/testdata/serve_expired_ttl_reset.rpl
Yorgos Thessalonikefs fff9f62a1e
Serve expired cache update fixes (#1174)
- Fixes a regression bug with serve-expired that appeared in 1.22.0
  and would not allow the iterator to update the cache with
  not-yet-validated entries resulting in increased outgoing traffic.

- Treat serve_expired_norec_ttl as a backoff timer for failed updates of expired records.
- Try to use expired answers instead of SERVFAIL if serve-expired is
  enabled even without serve-expired-client-timeout.
- Add suggestion to refresh the cached norec_ttl and expired_ttl when a
  response cannot update the usable expired entry.
2024-12-31 16:28:12 +01:00

101 lines
2.1 KiB
Text

; config options go here.
server:
serve-expired: yes
serve-expired-ttl: 1
serve-expired-ttl-reset: yes
serve-expired-reply-ttl: 123
serve-expired-client-timeout: 0
ede: yes
ede-serve-expired: yes
forward-zone: name: "." forward-addr: 216.0.0.1
CONFIG_END
SCENARIO_BEGIN Serve expired ttl with reset on forwarder with a timeout on upstream query
; Scenario overview:
; - Send query
; - Get reply
; - Wait for it to expire (+ serve-expired-ttl)
; - Send query again
; - Upstream timeouts
; - Error response from iterator SERVFAIL, resets expired-ttl on cache and sets norec_ttl blocking recursion
; - Check we are getting the cached response because it was expired-ttl-reset
; - Query again
; - Check we are getting the expired answer; prefetching is blocked by norec_ttl
; - If there was prefetching the test would fail with the pending upstream query
STEP 1 QUERY
ENTRY_BEGIN
REPLY RD
SECTION QUESTION
www.example.com. IN A
ENTRY_END
; Upstream reply
STEP 2 REPLY
ENTRY_BEGIN
REPLY QR AA NOERROR
SECTION QUESTION
www.example.com. IN A
SECTION ANSWER
www.example.com. 10 IN A 0.0.0.0
ENTRY_END
STEP 3 CHECK_ANSWER
ENTRY_BEGIN
MATCH all ttl
REPLY QR RA RD NOERROR
SECTION QUESTION
www.example.com. IN A
SECTION ANSWER
www.example.com. 10 IN A 0.0.0.0
ENTRY_END
; Expire the record (+ serve-expired-ttl)
STEP 4 TIME_PASSES ELAPSE 12
STEP 5 QUERY
ENTRY_BEGIN
REPLY RD DO
SECTION QUESTION
www.example.com. IN A
ENTRY_END
; But the pending query times out!
; outbound-msg-retry times timeout.
STEP 6 TIMEOUT
STEP 7 TIMEOUT
STEP 8 TIMEOUT
STEP 9 TIMEOUT
STEP 10 TIMEOUT
; Returns
; but error response from iterator resets the expired ttl
STEP 11 CHECK_ANSWER
ENTRY_BEGIN
MATCH all ttl ede=3
REPLY QR RA RD DO NOERROR
SECTION QUESTION
www.example.com. IN A
SECTION ANSWER
www.example.com. 123 IN A 0.0.0.0
ENTRY_END
; Query again
STEP 12 QUERY
ENTRY_BEGIN
REPLY RD DO
SECTION QUESTION
www.example.com. IN A
ENTRY_END
; Check that we get the expired answer
STEP 13 CHECK_ANSWER
ENTRY_BEGIN
MATCH all ttl ede=3
REPLY QR RA RD DO NOERROR
SECTION QUESTION
www.example.com. IN A
SECTION ANSWER
www.example.com. 123 IN A 0.0.0.0
ENTRY_END
SCENARIO_END