NetBSD Problem Report #55776

From gson@gson.org  Mon Nov  2 10:37:33 2020
Return-Path: <gson@gson.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0CE771A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  2 Nov 2020 10:37:33 +0000 (UTC)
Message-Id: <20201102103726.8CD57253EDE@guava.gson.org>
Date: Mon,  2 Nov 2020 12:37:26 +0200 (EET)
From: gson@gson.org (Andreas Gustafsson)
Reply-To: gson@gson.org (Andreas Gustafsson)
To: gnats-bugs@NetBSD.org
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.05.13.22.13.28
>Organization:
>Environment:
System: NetBSD
Architecture: x86_64
Machine: amd64
>Description:

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

>How-To-Repeat:

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

all: target1 target2
target1:
	$(MAKE) sub1
target2:
	$(MAKE) sub2
sub1: sub1_target1 sub1_target2
sub1_target1:
	sleep 0.1
sub1_target2:
	sleep 0.1
sub2: sub2_target1 sub2_target2
sub2_target1:
	sleep 5
sub2_target2:
	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.

>Fix:

The commit should be reverted, restoring the deleted statement.

>Release-Note:

>Audit-Trail:

>Unformatted:

NetBSD Home
NetBSD PR Database Search

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