From owner-freebsd-current@FreeBSD.ORG Wed Jan 9 18:59:34 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C16BC16A468 for ; Wed, 9 Jan 2008 18:59:34 +0000 (UTC) (envelope-from gavin.atkinson@ury.york.ac.uk) Received: from mail-gw1.york.ac.uk (mail-gw1.york.ac.uk [144.32.128.246]) by mx1.freebsd.org (Postfix) with ESMTP id 11D0713C442 for ; Wed, 9 Jan 2008 18:59:33 +0000 (UTC) (envelope-from gavin.atkinson@ury.york.ac.uk) Received: from mail-gw6.york.ac.uk (mail-gw6.york.ac.uk [144.32.129.26]) by mail-gw1.york.ac.uk (8.13.6/8.13.6) with ESMTP id m09IxNxG019702; Wed, 9 Jan 2008 18:59:23 GMT Received: from buffy-128.york.ac.uk ([144.32.128.160] helo=buffy.york.ac.uk) by mail-gw6.york.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1JCg95-0006CL-FC; Wed, 09 Jan 2008 18:59:23 +0000 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.1/8.14.1) with ESMTP id m09IxNr9076551; Wed, 9 Jan 2008 18:59:23 GMT (envelope-from gavin.atkinson@ury.york.ac.uk) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.1/8.14.1/Submit) id m09IxM8V076550; Wed, 9 Jan 2008 18:59:22 GMT (envelope-from gavin.atkinson@ury.york.ac.uk) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin.atkinson@ury.york.ac.uk using -f From: Gavin Atkinson To: David Frascone In-Reply-To: <9cf5ced20801090915i3df2d4a1lc057a38b20fc5ac2@mail.gmail.com> References: <9cf5ced20801090915i3df2d4a1lc057a38b20fc5ac2@mail.gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Wed, 09 Jan 2008 18:35:47 +0000 Message-Id: <1199903747.70812.43.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 FreeBSD GNOME Team Port X-York-MailScanner: Found to be clean X-York-MailScanner-From: gavin.atkinson@ury.york.ac.uk Cc: freebsd-current@freebsd.org Subject: Re: Small patch to fix top in large NIS environments X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Wed, 09 Jan 2008 18:59:34 -0000 On Wed, 2008-01-09 at 12:15 -0500, David Frascone wrote: > The -u flag to top is supposed to limit uid lookups. But, it was still > spinning through the entire password database with while (getpwent()). At > Cisco, which has a fairly large NIS database, this takes forever, and top > never starts. > > I filed this bug to address it: > http://www.freebsd.org/cgi/query-pr.cgi?pr=119490 > > The attached patch fixes it. This is my first submission, so let me know if > this is the proper order, etc, to post the patches (i.e. file the bug, the > post a fix) This is a longstanding bug, sadly. bin/20799 seems to be the first to mention it, and is over 7 years old now. Every system I deploy at work has to have top(1) patched to avoid this. I think your solution of not sizing the usernames when -u is specified is a sensible one, although I think some thought really needs to be put into whether sizing is necessary at all - maybe the solution is to just limit the username field to 8 or 10 characters or so, and either trim longer names or show them as userids. Parsing a huge (in my case ~25,000 users) password map when top is run seems stupid, especially given that many invocations of top are at exactly the time when significant extra load on a system is not a good idea. It would probably be best to submit your patch as a followup to PR bin/89762. Gavin