tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Build system race conditions



On Sat, Sep 13, 2014 at 07:23:58PM +0000, David Holland wrote:
 > The bug here is that whatever it was doing that failed to fork didn't
 > stop the build.

My guess is this:

   ${AR} ${_ARFL} ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`

and that part or all of the `` failed to fork and for some reason this
didn't cause the whole shell command to fail. Then you'll get an empty
.a file, and naturally nothing will work afterwards until it's been
removed.

Prodding sh suggests that there's a bug here:

   % limit maxproc 80
   % sh -c '(echo `true`) || echo failed'
   sh: Cannot fork (Resource temporarily unavailable)
   failed
   % sh -c '(echo `true | true`) || echo failed'
   sh: Cannot fork (Resource temporarily unavailable)
   failed
   % 

which is fine, but with just the right (wrong) limit:

   % limit maxproc 81
   % sh -c '(echo `true`) || echo failed'

   % sh -c '(echo `true | true`) || echo failed'
   sh: Cannot fork (Resource temporarily unavailable)

   %

In the second case one of the forks fails and it prints a message but
doesn't fail the substitution.

(80 vs. 81 is unimportant, that just reflects how much else I have
running right now)

In these conditions bash loops several times printing a retry message,
zsh behaves the same as sh, and ksh just hangs.

What are you building on, and with what shell?

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index