<div dir="ltr"><span style="font-family:-moz-fixed;font-size:12px">I've written some code based on the ttl modification code here:</span><br><div class="" style="font-family:-moz-fixed;font-size:12px" lang="x-western">
<pre><a class="" href="http://www.unbound.net/documentation/pythonmod/examples/example3.html">http://www.unbound.net/documentation/pythonmod/examples/example3.html</a>

I'm noticing an odd behavior that seems like it may be a bug.  I was
doing some testing and found that my responses that I get back from
unbound for the modified TTLs seem to be correct, but the cached entries
don't expire when the TTL reaches zero.

Here is an example.  I am setting the TTLs for <a href="http://google.com">google.com</a> to 5, instead
of their default 300, seconds. and when I do a dig against a cold cache,
this is what I get (as I would expect):

================================
; <<>> DiG 9.7.3 <<>> -p 5300 @localhost <a href="http://google.com">google.com</a>
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32474
;; flags: qr rd ra; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;<a href="http://google.com">google.com</a>.                      IN      A

;; ANSWER SECTION:
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.9
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.1
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.14
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.3
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.5
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.4
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.6
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.7
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.2
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.0
<a href="http://google.com">google.com</a>.               5       IN      A       173.194.33.8

;; Query time: 41 msec
;; SERVER: 127.0.0.1#5300(127.0.0.1)
;; WHEN: Mon Jan 14 12:18:30 2013
;; MSG SIZE  rcvd: 204
================================

Now, when I check again after 5 seconds:

================================
<snip>
;; ANSWER SECTION:
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.9
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.1
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.14
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.3
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.5
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.4
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.6
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.7
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.2
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.0
<a href="http://google.com">google.com</a>.               0       IN      A       173.194.33.8

;; Query time: 0 msec
;; SERVER: 127.0.0.1#5300(127.0.0.1)
;; WHEN: Mon Jan 14 12:19:43 2013
;; MSG SIZE  rcvd: 204
================================

Unbound continues to give this zero TTL response until the *original
server TTL* of 300 seconds expires.  I've also tried using python as the
first module in "module-config" with the invalidateQueryInCache() and
storeQueryInCache() method.  It doesn't seem to change the behavior.

Is this a bug, as I would expect, or the expected behavior?

Thank you,

Jay Deiman
</pre></div></div>