From owner-freebsd-current@FreeBSD.ORG Tue Sep 30 08:18:24 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DD3E4DF9 for ; Tue, 30 Sep 2014 08:18:23 +0000 (UTC) Received: from mx12.netapp.com (mx12.netapp.com [216.240.18.77]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "mx12.netapp.com", Issuer "VeriSign Class 3 International Server CA - G3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id BA69EF9A for ; Tue, 30 Sep 2014 08:18:22 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.04,625,1406617200"; d="asc'?scan'208";a="200254714" Received: from hioexcmbx08-prd.hq.netapp.com ([10.122.105.41]) by mx12-out.netapp.com with ESMTP; 30 Sep 2014 01:18:08 -0700 Received: from HIOEXCMBX07-PRD.hq.netapp.com (10.122.105.40) by hioexcmbx08-prd.hq.netapp.com (10.122.105.41) with Microsoft SMTP Server (TLS) id 15.0.913.22; Tue, 30 Sep 2014 01:17:48 -0700 Received: from HIOEXCMBX07-PRD.hq.netapp.com ([::1]) by hioexcmbx07-prd.hq.netapp.com ([fe80::79b6:a9a2:f48b:f065%21]) with mapi id 15.00.0913.011; Tue, 30 Sep 2014 01:17:48 -0700 From: "Eggert, Lars" To: David Shane Holden Subject: Re: [PATCH] nscd Thread-Topic: [PATCH] nscd Thread-Index: AQHP3GBjNT+2UfEjw0qtQx963geD6pwZyrAA Date: Tue, 30 Sep 2014 08:17:47 +0000 Message-ID: <007A0492-5F92-44E8-8904-699F4A42C667@netapp.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.1878.6) x-originating-ip: [10.122.56.79] Content-Type: multipart/signed; boundary="Apple-Mail=_BC6AF6C8-EBE8-4E30-8B94-062896192005"; protocol="application/pgp-signature"; micalg=pgp-sha1 MIME-Version: 1.0 Cc: "freebsd-current@freebsd.org" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2014 08:18:24 -0000 --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 Lars On 2014-9-30, at 5:40, David Shane Holden 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. > _______________________________________________ > 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--