[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gethostbyname() does not use positive nscd cache entries.
From: |
Alex Zarochentsev |
Subject: |
gethostbyname() does not use positive nscd cache entries. |
Date: |
Sun, 25 Nov 2001 23:54:57 +0300 |
User-agent: |
Mutt/1.3.22.1i |
Hello !
I'm running nscd on linux machine (intel, PentiumIII, SuSE 7.2) . I was
surprised that nscd does not help in repeatable host lookups -- glibc still
asks dns for IP addresses even if data presents in nscd cache (I ran nscd in
debug mode). More interesting that negative cache entries are not ignored by
gethostbyname().
It seems to me I found the reason why cached entries retrieving fails. I got
glibc 2.2.4 sources and did step-by-step debugging of my simple program which
only calls gethostbyname() for command line args. I found that cached entry
retrieval fails inside nscd_gethst_r() (nscd/nscd_gethst_r.c)
The error looks like nscd client/server protocol error that triggeres check
code at line 270. Breafly speaking, client expects more data from socket than
nscd sends. It causes expected/received data length mismatch, socket close and
return of an error. In my experiment the difference between expected and
received data length was 16 bytes. It seems to me, client expects additional
ipv6 address record that server does not send.
...
270: if (__readv (sock, vec, n) != total_len)
271: {
272: __close (sock);
273: return -1;
274: }
...
That problem (bug or my system misconfiguration, I am not sure) I had with
glibc-2.2.2 (default for SuSE 7.2) and problem still exists after my sytem
upgrade to SuSE 7.3 with glibc 2.2.4.
my nscd.conf:
# logfile /var/log/nscd.log
# threads 6
# server-user nobody
debug-level 0
enable-cache passwd yes
positive-time-to-live passwd 600
negative-time-to-live passwd 20
suggested-size passwd 211
check-files passwd yes
enable-cache group yes
positive-time-to-live group 3600
negative-time-to-live group 60
suggested-size group 211
check-files group yes
enable-cache hosts yes
positive-time-to-live hosts 3600
negative-time-to-live hosts 6
suggested-size hosts 211
check-files hosts yes
and nsswitch.conf:
passwd: compat
group: compat
hosts: files dns
networks: files dns
services: files
protocols: files
rpc: files
ethers: files
netmasks: files
netgroup: files
publickey: files
bootparams: files
automount: files
aliases: files
Thanks in advance for any help.
--
Alex.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gethostbyname() does not use positive nscd cache entries.,
Alex Zarochentsev <=