From crossd@phoenix.cs.rpi.edu Fri Feb 26 09:40:22 1999
Return-Path: <crossd@phoenix.cs.rpi.edu>
Received: from phoenix.cs.rpi.edu (phoenix.cs.rpi.edu [128.113.96.153])
	by hub.freebsd.org (Postfix) with ESMTP id 3902E14F8A
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 26 Feb 1999 09:40:18 -0800 (PST)
	(envelope-from crossd@phoenix.cs.rpi.edu)
Received: (from crossd@localhost)
	by phoenix.cs.rpi.edu (8.9.2/8.9.2) id MAA17549;
	Fri, 26 Feb 1999 12:39:52 -0500 (EST)
	(envelope-from crossd)
Message-Id: <199902261739.MAA17549@phoenix.cs.rpi.edu>
Date: Fri, 26 Feb 1999 12:39:52 -0500 (EST)
From: "David E. Cross" <crossd@phoenix.cs.rpi.edu>
Reply-To: crossd@phoenix.cs.rpi.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: Race condition in rc.network
X-Send-Pr-Version: 3.2

>Number:         10283
>Category:       bin
>Synopsis:       Race condition in rc.network
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 26 10:10:10 PST 1999
>Closed-Date:    Mon Nov 04 00:15:17 PST 2002
>Last-Modified:  Mon Nov 04 00:15:17 PST 2002
>Originator:     David E. Cross
>Release:        FreeBSD 3.1-STABLE i386
>Organization:
Rensselaer Polytechnic Institute, Department of Computer Science
>Environment:

	Automounted /usr/local with automount maps provided by NIS

>Description:

	AMD returns almost immediately when run, not waiting for for
initialization of the parent to complete.  In the network startup amd is
started as part of network_pass3, this occurs immediately before things like
ldconfig_paths, and scanning option directories for additional startup scripts,
the result is that sometimes the directories listed do not exist and therefore
are not added to ld.so's hint file or are not searched for additional files.

>How-To-Repeat:

	amd [OPTIONS]; ls -la /automounted/directory

>Fix:
	
	A loose loop after amd is called that waits for amd to come up before
allowing the startup sctipts to continue.  This is stolen from 'wait4amd',
which is included with the base AMD distribution from Columbia, is included
in our source tree, but is not included in our install??

(patch to rc.network is included below)

*** rc.network.old      Sat Feb 20 12:56:18 1999
--- rc.network  Sat Feb 20 13:05:29 1999
***************
*** 284,294 ****
      fi
  
      if [ "X${amd_enable}" = X"YES" ]; then
!           echo -n ' amd'
            if [ "X${amd_map_program}" != X"NO" ]; then
                amd_flags="${amd_flags} `eval ${amd_map_program}`"
            fi
            amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null
      fi
  
      if [ "X${rwhod_enable}" = X"YES" ]; then
--- 284,299 ----
      fi
  
      if [ "X${amd_enable}" = X"YES" ]; then
!           echo -n ' amd('
            if [ "X${amd_map_program}" != X"NO" ]; then
                amd_flags="${amd_flags} `eval ${amd_map_program}`"
            fi
            amd -p ${amd_flags} > /var/run/amd.pid 2> /dev/null
+           while ! amq >/dev/null 2>&1; do
+               echo -n .
+               sleep 1;
+           done
+           echo -n ')'
      fi
  
      if [ "X${rwhod_enable}" = X"YES" ]; then

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: iedowse 
State-Changed-When: Sun Jan 20 08:50:14 PST 2002 
State-Changed-Why:  

Is this bug still present in recent releases? 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=10283 
Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: johan 
Responsible-Changed-When: Wed Aug 21 12:15:25 PDT 2002 
Responsible-Changed-Why:  
Doug has been doing commits in this area before. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=10283 
State-Changed-From-To: feedback->closed 
State-Changed-By: dougb 
State-Changed-When: Mon Nov 4 00:14:20 PST 2002 
State-Changed-Why:  

Feedback timeout. If this is still a problem on 4.7-RELEASE 
or later, please ask to re-open this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=10283 
>Unformatted:
