Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 2014 08:17:47 +0000
From:      "Eggert, Lars" <lars@netapp.com>
To:        David Shane Holden <dpejesh@yahoo.com>
Cc:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: [PATCH] nscd
Message-ID:  <007A0492-5F92-44E8-8904-699F4A42C667@netapp.com>
In-Reply-To: <m0d8o4$qa3$1@ger.gmane.org>
References:  <m0d8o4$qa3$1@ger.gmane.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_BC6AF6C8-EBE8-4E30-8B94-062896192005
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

Hi,

I've been seeing the same issues with nscd not caching, but =
unfortunately your patch doesn't seem to change things, for better or =
worse.

My nsswitch.conf looks as follows:

group: cache files nis
hosts: cache files dns
networks: cache files
passwd: cache files nis
shells: files
services: cache files nis
protocols: cache files
rpc: cache files

When I start "nscd -n -s -t" and then run top in another shell, top =
takes ~10 seconds to start up every time; if nscd did its thing, repeat =
invocations should be much faster. nscd doesn't seem to see any activity =
either, based on its log:

[elars@one: ~] sudo nscd -n -s -t
M1 from main: request agents registered successfully
M2 from cache: cache was successfully initialized
M2 from runtime environment: using socket /var/run/nscd
M2 from runtime environment: successfully initialized
M1 from main: working in single-threaded mode
<no further output>

Lars

On 2014-9-30, at 5:40, David Shane Holden <dpejesh@yahoo.com> wrote:

> So, I've noticed nscd hasn't worked right for awhile now.  Since I
> upgraded to 10.0 it never seemed to cache properly but I never =
bothered
> to really dig into it until recently and here's what I've found.  In =
my
> environment I have nsswitch set to use caching and LDAP as such:
>=20
> group: files cache ldap
> passwd: files cache ldap
>=20
> The LDAP part works fine, but caching didn't on 10.0 for some reason.
> On my 9.2 machines it works as expected though.  What I've found is in
> usr.sbin/nscd/query.c
>=20
> struct query_state *
> init_query_state(int sockfd, size_t kevent_watermark, uid_t euid, =
gid_t
> egid)
> {
>  ...
> 	memcpy(&retval->timeout, &s_configuration->query_timeout,
> 		sizeof(struct timeval));
>  ...
> }
>=20
> s_configuration->query_timeout is an 'int' which is being memcpy'd =
into
> a 'struct timeval' causing it to grab other parts of the =
s_configuration
> struct along with the query_timeout value and polluting =
retval->timeout.
> In this case it appears to be grabbing s_configuration->threads_num =
and
> shoving that into timeout.tv_sec along with the query_timeout. This =
ends
> up confusing nscd later on (instead of being 8 it ends up being set to
> 34359738376) and breaks it's ability to cache.  I've attached a patch =
to
> set the retval->timeout properly and gets nscd working again.  I'm
> guessing gcc was handling this differently from clang which is why it
> wasn't a problem before 10.0.
> <nscd.patch>_______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to =
"freebsd-current-unsubscribe@freebsd.org"


--Apple-Mail=_BC6AF6C8-EBE8-4E30-8B94-062896192005
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="signature.asc"
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Message signed with OpenPGP using GPGMail

-----BEGIN PGP SIGNATURE-----

iQCVAwUBVCpnONZcnpRveo1xAQLtXQP+Jg4yMI5XrHx+0nXX7wJEkcgiLYJP+frZ
tiuvuLgJXLkfAY2IwDh6fe8wIH3BthPNbkCLx0lNW20QQU9UryNHhy1tYNaqX9+g
8c0a5KuUhTNM2yPsFPr6ektXcLXHhmvPTi9PaGOQ56MIN0D/z1lUTP+bxGH4K0iG
zVxKZHKPe20=
=NKgc
-----END PGP SIGNATURE-----

--Apple-Mail=_BC6AF6C8-EBE8-4E30-8B94-062896192005--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?007A0492-5F92-44E8-8904-699F4A42C667>