NetBSD Problem Report #15355

Received: (qmail 11044 invoked from network); 24 Jan 2002 21:53:41 -0000
Message-Id: <200201242152.g0OLqIh00566@sofa.aquery.com>
Date: Thu, 24 Jan 2002 16:52:18 -0500 (EST)
From: fredette@netbsd.org
Reply-To: fredette@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: ypbind prevents disk idle spindown
X-Send-Pr-Version: 3.95

>Number:         15355
>Category:       bin
>Synopsis:       ypbind defeats disk idle spindown
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dholland
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 24 21:54:00 +0000 2002
>Closed-Date:    Tue Jun 10 17:22:12 +0000 2014
>Last-Modified:  Mon Nov 03 18:50:00 +0000 2014
>Originator:     Matthew Fredette
>Release:        NetBSD 1.5
>Organization:
	Self
>Environment:
System: NetBSD the-weight.home 1.5 NetBSD 1.5 (SOFA) #3: Sun Sep 16 12:52:24 EDT 2001 fredette@no.where:/data/home/fredette/project/maestro/sys/arch/i386/compile/SOFA i386


>Description:
	Even when connected to a stable server, ypbind still "hits
	the disk" at least once a minute.  This defeats setting a
	laptop disk to spin down when idle, because it never truly
	becomes idle.
>How-To-Repeat:
	Configure a system to spin down its hard drive when idle,
	and do whatever else is necessary to make the system truly
	idle.  Confirm a spun-down disk for least five minutes
	to convince self that system is idle.  Now start ypbind and
	observe that disk no longer stays spun down for five
	minutes at a time.

	Alternately, look at ypbind sources and observe a state
	machine that apparently does some sort of file locking/
	reading/writing on state transitions.
>Fix:
	Either add an option to have ypbind cycle less frequently,
	or otherwise revisit whatever ypbind does with the file(s)
	it touches.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: jruoho@NetBSD.org
State-Changed-When: Tue, 03 May 2011 17:05:19 +0000
State-Changed-Why:

I will close this. There are numerous programs with the same behavior in the
base system of NetBSD, and even more are available from pkgsrc. It is 
expected that most of these will not be fixed.  (And well, frankly, you 
probably should not run ypbind(8) on a laptop to begin with, if power   
consumption matters.) One current option is to shutdown heavy daemons from 
powerd(8) when the status of the AC adapter changes.



State-Changed-From-To: closed->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Wed, 04 May 2011 17:29:59 +0000
State-Changed-Why:
I disagree, it should behave itself.


Responsible-Changed-From-To: bin-bug-people->dholland
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Wed, 04 May 2011 17:30:53 +0000
Responsible-Changed-Why:
I've been looking at ypbind in connection with some other PRs already.


State-Changed-From-To: open->analyzed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 23 May 2011 06:31:20 +0000
State-Changed-Why:
ok, the problem (or at least a large part of it) seems to me that every time
ypbind hears from the server it truncates and rewrites the binding file.
This is ... pretty dumb and shouldn't be all that hard to fix once I finish
rototilling.

Unless of course the yp code in libc depends on this behavior or something
similarly inane.


From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/15355 CVS commit: src/usr.sbin/ypbind
Date: Tue, 10 Jun 2014 17:19:22 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Tue Jun 10 17:19:22 UTC 2014

 Modified Files:
 	src/usr.sbin/ypbind: ypbind.c

 Log Message:
 Instead of using magic numbers in what looks like a boolean
 (dom_alive), create a state enumeration (domainstates) and use it
 instead.

 Instead of three states (new, alive, and, effectively, 'troubled') go
 to five: new, alive, pinging, lost, and dead.

 Domains start in the NEW state. When we get a reply from a server, the
 state goes to ALIVE. The state is set to PINGING when we ping the
 server (once a minute normally) and if the ping times out, it goes to
 LOST. If we stay lost for a minute, go to DEAD, and in DEAD, do
 exponential backoff of nag_servers calls.

 Getting rid of the broken logic attached to the 'troubled' state fixes
 PR 15355 (ypbind defeats disk idle spindown) -- it will now only
 rewrite the binding file when the binding changes.

 Also, fix the HEURISTIC code so it doesn't trigger except in ALIVE
 state. I think this was the source of a lot of the spamming behavior
 seen in PR 32519, which is now fixed.

 Might also fix PR 23135 (broadcast ypbind sometimes fails to find
 servers).


 To generate a diff of this commit:
 cvs rdiff -u -r1.95 -r1.96 src/usr.sbin/ypbind/ypbind.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: analyzed->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 10 Jun 2014 17:22:12 +0000
State-Changed-Why:
Fixed.
(in HEAD - not clear if pullups to -5 and -6 are worthwhile; see 32519)


From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/15355 CVS commit: [netbsd-6] src/usr.sbin/ypbind
Date: Tue, 9 Sep 2014 08:24:29 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Tue Sep  9 08:24:29 UTC 2014

 Modified Files:
 	src/usr.sbin/ypbind [netbsd-6]: ypbind.8 ypbind.c

 Log Message:
 Pull up following revision(s) (requested by dholland in ticket #1083):
 	usr.sbin/ypbind/ypbind.c: revision 1.91
 	usr.sbin/ypbind/ypbind.c: revision 1.92
 	usr.sbin/ypbind/ypbind.c: revision 1.93
 	usr.sbin/ypbind/ypbind.c: revision 1.94
 	usr.sbin/ypbind/ypbind.c: revision 1.95
 	usr.sbin/ypbind/ypbind.c: revision 1.96
 	usr.sbin/ypbind/ypbind.c: revision 1.97
 	usr.sbin/ypbind/ypbind.c: revision 1.98
 	usr.sbin/ypbind/ypbind.8: revision 1.20
 	usr.sbin/ypbind/ypbind.8: revision 1.19
 Don't store the default domain name in a global. While running we
 really don't care which domain is the system's default domain.
 Factor out some rpc validation code.
 While there are times it's appropriate to call a state variable
 "evil", this isn't one of them. Since the logic involved is to wait
 until the default domain binds before backgrounding, call the variable
 "started" instead.
 Don't rake up the default domain until after processing arguments.
 Processing arguments just sets flags -- may as well do it first, and
 this way detection of silly errors isn't contingent on having things
 fully configured and operating.
 Load up with comments.
 Instead of using magic numbers in what looks like a boolean
 (dom_alive), create a state enumeration (domainstates) and use it
 instead.
 Instead of three states (new, alive, and, effectively, 'troubled') go
 to five: new, alive, pinging, lost, and dead.
 Domains start in the NEW state. When we get a reply from a server, the
 state goes to ALIVE. The state is set to PINGING when we ping the
 server (once a minute normally) and if the ping times out, it goes to
 LOST. If we stay lost for a minute, go to DEAD, and in DEAD, do
 exponential backoff of nag_servers calls.
 Getting rid of the broken logic attached to the 'troubled' state fixes
 PR 15355 (ypbind defeats disk idle spindown) -- it will now only
 rewrite the binding file when the binding changes.
 Also, fix the HEURISTIC code so it doesn't trigger except in ALIVE
 state. I think this was the source of a lot of the spamming behavior
 seen in PR 32519, which is now fixed.
 Might also fix PR 23135 (broadcast ypbind sometimes fails to find
 servers).
 Add a SIGHUP handler; upon SIGHUP do an extra nag_servers on any
 domain that's in DEAD state. This lets you explicitly rescue ypbind
 from its exponential backoff when you know the world's back up.
 Log state transitions.
 Don't store the default domain name in a global. While running we
 really don't care which domain is the system's default domain.
 Factor out some rpc validation code.
 While there are times it's appropriate to call a state variable
 "evil", this isn't one of them. Since the logic involved is to wait
 until the default domain binds before backgrounding, call the variable
 "started" instead.
 Don't rake up the default domain until after processing arguments.
 Processing arguments just sets flags -- may as well do it first, and
 this way detection of silly errors isn't contingent on having things
 fully configured and operating.
 Load up with comments.
 Instead of using magic numbers in what looks like a boolean
 (dom_alive), create a state enumeration (domainstates) and use it
 instead.
 Instead of three states (new, alive, and, effectively, 'troubled') go
 to five: new, alive, pinging, lost, and dead.
 Domains start in the NEW state. When we get a reply from a server, the
 state goes to ALIVE. The state is set to PINGING when we ping the
 server (once a minute normally) and if the ping times out, it goes to
 LOST. If we stay lost for a minute, go to DEAD, and in DEAD, do
 exponential backoff of nag_servers calls.
 Getting rid of the broken logic attached to the 'troubled' state fixes
 PR 15355 (ypbind defeats disk idle spindown) -- it will now only
 rewrite the binding file when the binding changes.
 Also, fix the HEURISTIC code so it doesn't trigger except in ALIVE
 state. I think this was the source of a lot of the spamming behavior
 seen in PR 32519, which is now fixed.
 Might also fix PR 23135 (broadcast ypbind sometimes fails to find
 servers).
 Add a SIGHUP handler; upon SIGHUP do an extra nag_servers on any
 domain that's in DEAD state. This lets you explicitly rescue ypbind
 from its exponential backoff when you know the world's back up.
 Log state transitions.
 Document exponential backoff behavior and SIGHUP support, plus a couple
 other minor edits.
 Use more markup.


 To generate a diff of this commit:
 cvs rdiff -u -r1.18 -r1.18.22.1 src/usr.sbin/ypbind/ypbind.8
 cvs rdiff -u -r1.90 -r1.90.4.1 src/usr.sbin/ypbind/ypbind.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/15355 CVS commit: [netbsd-5] src/usr.sbin/ypbind
Date: Mon, 3 Nov 2014 18:48:42 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Mon Nov  3 18:48:42 UTC 2014

 Modified Files:
 	src/usr.sbin/ypbind [netbsd-5]: ypbind.8 ypbind.c

 Log Message:
 Pull up following revision(s) (requested by jmcneill in dholland ticket #1925):
 	usr.sbin/ypbind/ypbind.8	1.19-1.20
 	usr.sbin/ypbind/ypbind.c	1.63-1.98

 State handling fixes and cleanups in ypbind; it no longer churns the
 disk, spams syslogd when the server goes down, or gets confused about
 its binding state. Fixes PR#15355, PR#32519 and also PR#43900.


 To generate a diff of this commit:
 cvs rdiff -u -r1.18 -r1.18.6.1 src/usr.sbin/ypbind/ypbind.8
 cvs rdiff -u -r1.57.18.1 -r1.57.18.2 src/usr.sbin/ypbind/ypbind.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.