NetBSD Problem Report #55776

From  Mon Nov  2 10:37:33 2020
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 0CE771A9239
	for <>; Mon,  2 Nov 2020 10:37:33 +0000 (UTC)
Message-Id: <>
Date: Mon,  2 Nov 2020 12:37:26 +0200 (EET)
From: (Andreas Gustafsson)
Reply-To: (Andreas Gustafsson)
Subject: make(1) job token breakage
X-Send-Pr-Version: 3.95

>Number:         55776
>Notify-List:    kim
>Category:       bin
>Synopsis:       make(1) job token breakage
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 02 10:40:00 +0000 2020
>Last-Modified:  Mon Nov 02 21:58:12 +0000 2020
>Originator:     Andreas Gustafsson
>Release:        9.0, -current source date >= 2018.
System: NetBSD
Architecture: x86_64
Machine: amd64

The commit of src/usr.bin/make/job.c 1.195 removed a single statement
"wantToken = 1;" with the following commit message:

  Just skip polling job token pipe.

  The sigchld pipe ensures no busy wait.

  PR: 53285
  Reviewed by:

After this commit, a make process that is waiting for a job token will
no longer wake up when a token becomes available in another make
process in the same build.  As a result, the number of parallel jobs
specified with the "-j" option may not be achieved even though there
are enough buildable targets.

The commit in case also has multiple other issues:

 - The statement "The sigchld pipe ensures no busy wait" in the commit
   message makes no sense

 - The reference to PR 53285 is misleading, as that issue was not fixed
   by this commit

 - The actual problem that the commit was intended to fix is not stated

 - It makes the variable wantToken pointless as its value is now always zero

 - It makes the comment "If pool is empty, set wantToken so that we wake
   up when a token is released" untrue


Save the following as Makefile (taking care to preserve the tabs)
and run "time make -j2":

all: target1 target2
	$(MAKE) sub1
	$(MAKE) sub2
sub1: sub1_target1 sub1_target2
	sleep 0.1
	sleep 0.1
sub2: sub2_target1 sub2_target2
	sleep 5
	sleep 5

In NetBSD 8.2, this takes about five seconds to run.  In NetBSD 9.0
and -current, which include job.c 1.195, the run time has increased to
about 10 seconds.


The commit should be reverted, restoring the deleted statement.




NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.