From nobody@FreeBSD.org  Wed Jul 31 14:52:30 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3FDE737B400
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 31 Jul 2002 14:52:30 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0191843E3B
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 31 Jul 2002 14:52:30 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g6VLqTOT009316
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 31 Jul 2002 14:52:29 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g6VLqTCp009315;
	Wed, 31 Jul 2002 14:52:29 -0700 (PDT)
Message-Id: <200207312152.g6VLqTCp009315@www.freebsd.org>
Date: Wed, 31 Jul 2002 14:52:29 -0700 (PDT)
From: Stefan Schwarzer <sschwarzer@sschwarzer.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: top(1) blocks if NIS-related entries in passwd(5) are in a certain order
X-Send-Pr-Version: www-1.0

>Number:         41213
>Category:       bin
>Synopsis:       top(1) blocks if NIS-related entries in passwd(5) are in a certain order
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 31 15:00:06 PDT 2002
>Closed-Date:    
>Last-Modified:  Thu Jul 22 07:04:00 GMT 2004
>Originator:     Stefan Schwarzer
>Release:        Release 4.6
>Organization:
TU Clausthal
>Environment:
FreeBSD purpurea.rz.tu-clausthal.de 4.6-RELEASE-p1 FreeBSD 4.6-RELEASE-p1 #4: Tue Jul 16 19:01:33 CEST 2002 root@purpurea.rz.tu-clausthal.de:/usr/obj/usr/src/sys/PURPUREA  i386
>Description:
      see http://docs.freebsd.org/cgi/getmsg.cgi?fetch=153740+0+archive/2002/freebsd-questions/20020728.freebsd-questions and http://docs.freebsd.org/cgi/getmsg.cgi?fetch=639426+0+archive/2002/freebsd-questions/20020728.freebsd-questions
>How-To-Repeat:
      I don't know if the problem also occurs on other machines. At least, it was reproducible on the machine in question, that the problem went away when the NIS netgroup entry was placed after all the NIS accounts (see URLs under "Full Description").
>Fix:
      I know only a workaround, see the URLs. I do not know, though, whether this workaround is feasible in any case.
>Release-Note:
>Audit-Trail:

From: Stefan Schwarzer <sschwarzer@sschwarzer.net>
To: freebsd-gnats-submit@FreeBSD.org, sschwarzer@sschwarzer.net
Cc:  
Subject: Re: misc/41213: top(1) blocks if NIS-related entries in passwd(5)
 are in a certain order
Date: Thu, 01 Aug 2002 18:33:32 +0200

 Regarding the workaround, of course I meant
 
 "I know only a workaround, see the URLs. I do not know, though, whether this
 workaround is feasible in _every_ case."
 
 (At least, it helped me. ;-) )
 
 Stefan
 
 
 

From: David Malone <dwmalone@maths.tcd.ie>
To: Stefan Schwarzer <sschwarzer@sschwarzer.net>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: misc/41213: top(1) blocks if NIS-related entries in passwd(5) are in a certain order
Date: Thu, 8 Aug 2002 10:46:47 +0100

 On Wed, Jul 31, 2002 at 02:52:29PM -0700, Stefan Schwarzer wrote:
 >       I know only a workaround, see the URLs. I do not know, though, whether this workaround is feasible in any case.
 
 This might be a bug in the code for iterating through all users
 in libc.  I think that top tries to do this to find the longest
 username it will have to deal with. Could you try the included
 simple C program and see if you can reproduce the problem? It should
 keep looping on the problem user.
 
 If you want to check it is this code that is looping, the last thing
 before top gets stuck in a loop should be the calling of sysctlbyname
 on either "machdep.smp_active" or "smp.smp_active". You may be able
 to find this in your ktrace output.
 
 	David.
 
 #include <sys/types.h>
 
 #include <pwd.h>
 #include <stdio.h>
 
 int
 main(void) {
 	struct passwd *pw;
 
 	while ((pw = getpwent()) != NULL) {
 		printf("Got user '%s',\n", pw->pw_name);
 	}
 	return 0;
 }

From: Stefan Schwarzer <sschwarzer@sschwarzer.net>
To: David Malone <dwmalone@maths.tcd.ie>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: misc/41213: top(1) blocks if NIS-related entries in passwd(5)
 are in a certain order
Date: Thu, 08 Aug 2002 21:14:23 +0200

 Hello David
 
 David Malone wrote:
 > This might be a bug in the code for iterating through all users
 > in libc.  I think that top tries to do this to find the longest
 > username it will have to deal with. Could you try the included
 > simple C program and see if you can reproduce the problem? It should
 > keep looping on the problem user.
 
 I've tried the program with my workaround applied and for two different
 positions of the netgroup entry I spoke of. For the latter two of the three
 positions, the program loops.
 
 > If you want to check it is this code that is looping, the last thing
 > before top gets stuck in a loop should be the calling of sysctlbyname
 > on either "machdep.smp_active" or "smp.smp_active". You may be able
 > to find this in your ktrace output.
 
 I couldn't find that, however (searching the dump in less for sysctlbyname).
 
 Stefan
 
>Unformatted:
