You are not logged in.

#1 2010-09-17 22:41:20

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

[resolved] pdnsd not caching

I have installed pdnsd using the wiki instructions but it doesn't appear to be caching.  It always performs a new lookup.  pdnsd 1.2.8-1 with glibc 2.12.1-1   The cache file is saved on exit but is always 12 bytes.

I have tried running it as both root and as pdnsd.  I have tried removing all the various ttl and other options.  I have tried my ISP servers as well as OpenDNS.  Same result with records that return an IP or a CNAME.  If I dump the entire cache with pdnsd-ctl it contains only /etc/hosts entries.  DHCP is not used on this system - static IP behind a NAT router.  By comparison, dnsmasq worked normally.

The debug file reports "p_dns_resolve: merging answer with cache failed, using local cent copy." on every lookup.  Is this normal?  I can't find much about this error.

The author notes in the build instructions:

--with-thread-lib=lib        Added by Paul Rombouts: Use this option if you experience problems with signal handling under Linux. The usual symptom is that pdnsd fails to save the cache to disk, and /var/cache/pdnsd/pdnsd.cache remains empty. If you experience this kind of trouble, try reconfiguring with different values for the --with-thread-lib option. The allowable values are linuxthreads (or lt for short), linuxthreads2  (or lt2 for short), and nptl. By default the configure script tries to detect automatically whether linuxthreads or nptl is more appropriate for your system, but the method used is not foolproof. Look for the line: checking if this is an NPTL-based system...
If the automatic test mistakenly indentifies the thread library on your system as NPTL based, you should reconfigure with --with-thread-lib=lt and recompile. If the result of the automatic test is "no" or if --with-thread-lib=lt does not have the desired effect, try again using --with-thread-lib=lt2 .

I didn't build it - installed it from community.  Nor is it just the disk cache which isn't working - it's not caching at all.

I'm out of ideas so any input is appreciated.  Is this a bug?


# cat /etc/resolv.conf

nameserver 127.0.0.1



# cat /etc/pdnsd.conf

// Read the pdnsd.conf(5) manpage for an explanation of the options.
// Add or remove '#' in front of options you want to disable or enable, respectively.
// Remove '/*' and '*/' to enable complete sections.

global {
    perm_cache=2048;
    cache_dir="/var/cache/pdnsd";
#    pid_file = /var/run/pdnsd.pid;
    run_as="pdnsd";
    strict_setuid=on;
    server_ip = 127.0.0.1;  # Use eth0 here if you want to allow other
                # machines on your network to query pdnsd.
    status_ctl = on;
#    paranoid=on;       # This option reduces the chance of cache poisoning
                       # but may make pdnsd less efficient, unfortunately.
    query_method=udp_tcp;
    min_ttl=2d;
    max_ttl=1w;        # One week.
    timeout=4;        # Global timeout option (10 seconds).
    neg_domain_pol=on;
    neg_rrs_pol=on;
    par_queries=2;
    neg_ttl=1h;
    run_ipv4=on;    # IPv6 disabled
    tcp_qtimeout=4;
    verbosity=3;
    debug=on;
}

# The servers provided by OpenDNS are fast, but they do not reply with
# NXDOMAIN for non-existant domains, instead they supply you with an
# address of one of their search engines. They also lie about the addresses of 
# of the search engines of google, microsoft and yahoo.
# If you do not like this behaviour the "reject" option may be useful.
server {
    label = "opendns";
    ip = 208.67.222.222, 208.67.220.220;
    reject = 67.215.65.132,
             208.69.32.0/24,  # You may need to add additional address ranges
             208.69.34.0/24,  # here if the addresses of their search engines
             208.67.219.0/24; # change.
    reject_policy = negate;     # If you do not provide any alternative server
                              # sections, like the following root-server
                              # example, "negate" may be more appropriate here.
    timeout = 2;
    uptest = query;
    interval = 15m;           # Test every 15 minutes.
    #preset = off;
    proxy_only=on;
    purge_cache=off;
}

source {
    owner=localhost;
#    serve_aliases=on;
    file="/etc/hosts";
}

rr {
    name=localhost;
    reverse=on;
    a=127.0.0.1;
    owner=localhost;
    soa=localhost,root.localhost,42,86400,900,86400,86400;
}




# /etc/rc.d/pdnsd start



$ dig www.archlinux.org

; <<>> DiG 9.7.1-P2 <<>> www.archlinux.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62768
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.archlinux.org.        IN    A

;; ANSWER SECTION:
www.archlinux.org.    6971    IN    CNAME    gudrun.archlinux.org.
gudrun.archlinux.org.    6374    IN    A    66.211.214.131

;; Query time: 57 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Sep 17 13:05:41 2010
;; MSG SIZE  rcvd: 72




$ dig www.archlinux.org

; <<>> DiG 9.7.1-P2 <<>> www.archlinux.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6491
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.archlinux.org.        IN    A

;; ANSWER SECTION:
www.archlinux.org.    6969    IN    CNAME    gudrun.archlinux.org.
gudrun.archlinux.org.    6372    IN    A    66.211.214.131

;; Query time: 59 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Fri Sep 17 13:05:42 2010
;; MSG SIZE  rcvd: 72




# pdnsd-ctl dump www.archlinux.org
Opening socket /var/cache/pdnsd/pdnsd.status
Could not find www.archlinux.org in the cache.
Succeeded




# ls /var/cache/pdnsd/
total 16
drwx------ 2 pdnsd pdnsd 4096 Sep 17 13:05 .
drwxr-xr-x 9 root  root  4096 Sep 17 09:26 ..
-rw------- 1 pdnsd pdnsd   12 Sep 17 13:05 pdnsd.cache
-rw------- 1 pdnsd pdnsd 3247 Sep 17 13:08 pdnsd.debug
srw------- 1 pdnsd pdnsd    0 Sep 17 13:05 pdnsd.status




# cat /var/cache/pdnsd/pdnsd.debug

* 09/17 13:05:37| pdnsd: info: pdnsd-1.2.8-par starting.
- 09/17 13:05:37| Debug messages activated
- 09/17 13:05:37| Using IPv4.
* 09/17 13:05:37| pdnsd: info: Server status thread started.
* 09/17 13:05:37| pdnsd: info: Status thread started.
* 09/17 13:05:37| pdnsd: info: tcp server thread started.
* 09/17 13:05:37| pdnsd: info: udp server thread started.
- 09/17 13:05:37| All threads started successfully.
- 09/17 13:05:37| performing uptest (type=query) for 208.67.222.222
- 09/17 13:05:37| Server 208.67.222.222 returned error code: query format error
- 09/17 13:05:37| result of uptest for 208.67.222.222: OK
- 09/17 13:05:37| performing uptest (type=query) for 208.67.220.220
- 09/17 13:05:37| Server 208.67.220.220 returned error code: query format error
- 09/17 13:05:37| result of uptest for 208.67.220.220: OK
1 09/17 13:05:41| Received query.
1 09/17 13:05:41| Questions are:
1 09/17 13:05:41|     qc=IN (1), qt=A (1), query="www.archlinux.org."
1 09/17 13:05:41| Starting cached resolve for: www.archlinux.org., query A
1 09/17 13:05:41| Trying name servers.
1 09/17 13:05:41| Sending query to 208.67.222.222
1 09/17 13:05:41| Sending query to 208.67.220.220
1 09/17 13:05:41| Marked server 208.67.222.222 up.
1 09/17 13:05:41| Caching type A for domain www.archlinux.org. negative with ttl 3600
1 09/17 13:05:41| Query to 208.67.222.222 succeeded.
1 09/17 13:05:41| p_dns_resolve: merging answer with cache failed, using local cent copy.
1 09/17 13:05:41| Starting cached resolve for: gudrun.archlinux.org., query A
1 09/17 13:05:41| Trying name servers.
1 09/17 13:05:41| Sending query to 208.67.222.222
1 09/17 13:05:41| Sending query to 208.67.220.220
1 09/17 13:05:41| Marked server 208.67.222.222 up.
1 09/17 13:05:41| Query to 208.67.222.222 succeeded.
1 09/17 13:05:41| p_dns_resolve: merging answer with cache failed, using local cent copy.
1 09/17 13:05:41| Outbound msg len 72, tc=0, rc="no error"
1 09/17 13:05:41| Answering to: 127.0.0.1, source address: 127.0.0.1
2 09/17 13:05:42| Received query.
2 09/17 13:05:42| Questions are:
2 09/17 13:05:42|     qc=IN (1), qt=A (1), query="www.archlinux.org."
2 09/17 13:05:42| Starting cached resolve for: www.archlinux.org., query A
2 09/17 13:05:42| Trying name servers.
2 09/17 13:05:42| Sending query to 208.67.222.222
2 09/17 13:05:42| Sending query to 208.67.220.220
2 09/17 13:05:42| Marked server 208.67.222.222 up.
2 09/17 13:05:42| Caching type A for domain www.archlinux.org. negative with ttl 3600
2 09/17 13:05:42| Query to 208.67.222.222 succeeded.
2 09/17 13:05:42| p_dns_resolve: merging answer with cache failed, using local cent copy.
2 09/17 13:05:42| Starting cached resolve for: gudrun.archlinux.org., query A
2 09/17 13:05:42| Trying name servers.
2 09/17 13:05:42| Sending query to 208.67.222.222
2 09/17 13:05:42| Sending query to 208.67.220.220
2 09/17 13:05:42| Marked server 208.67.222.222 up.
2 09/17 13:05:42| Query to 208.67.222.222 succeeded.
2 09/17 13:05:42| p_dns_resolve: merging answer with cache failed, using local cent copy.
2 09/17 13:05:42| Outbound msg len 72, tc=0, rc="no error"
2 09/17 13:05:42| Answering to: 127.0.0.1, source address: 127.0.0.1




# cat /var/log/daemon.log

Sep 17 13:13:08 localhost pdnsd[7188]: pdnsd-1.2.8-par starting.
Sep 17 13:13:08 localhost pdnsd[7188]: Server status thread started.
Sep 17 13:13:08 localhost pdnsd[7188]: Status thread started.
Sep 17 13:13:08 localhost pdnsd[7188]: tcp server thread started.
Sep 17 13:13:08 localhost pdnsd[7188]: udp server thread started.

Last edited by IgnorantGuru (2010-09-19 22:04:35)

Offline

#2 2010-09-19 22:04:13

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: [resolved] pdnsd not caching

Finally I have solved this...  I was using a very large /etc/hosts file (about 700K, 21000 lines) which apparently filled the cache (or at least stopped the cache from accepting new entries), even when the cache size was set to 5MB.  Removing that hosts file or making the cache size about 10MB resolved the problem.  Apparently cached /etc/hosts records are not removed from the cache for new server records, making it appear that server records are not being cached.  I have spoken with the current maintainer about adding a debug message (or other solution) for this situation.

Offline

#3 2010-12-01 15:59:39

tobreme
Member
Registered: 2010-12-01
Posts: 1

Re: [resolved] pdnsd not caching

Thank you very much Ignorant Guru, this has fixed the issue for me. Cheers. smile
-tobreme

Offline

Board footer

Powered by FluxBB