Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eBcTc-0008Ok-TK for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Nov 2017 08:09:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eBcTc-00054B-G3 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Nov 2017 08:09:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eBcRu-0000z4-CO for pgsql-hackers@postgresql.org; Mon, 06 Nov 2017 08:08:02 +0000 Received: from mail-pf0-x22e.google.com ([2607:f8b0:400e:c00::22e]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1eBcRr-0006o1-7s for pgsql-hackers@postgresql.org; Mon, 06 Nov 2017 08:08:01 +0000 Received: by mail-pf0-x22e.google.com with SMTP id p87so7183480pfj.3 for ; Mon, 06 Nov 2017 00:07:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=coUXoPguI94iOmD4hko9ASn+2+Tf0kSuW0AIQkfGpjM=; b=BfRZcWE8axtu7aa0s/P9wooOhjRAnMJbkDY+Bj2aom/gOarzTO3I608p+2pFmWCtQ2 JJYdAW8L9RAgdD/+vHGSAHojmog2ji2EbD5YWyKEjSqh8AUxO9IFuU4tOzUQgXPLWK+9 pjTkhWjNWDNmZPBsH4XLD1Bslr+qnkVDuM+5g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=coUXoPguI94iOmD4hko9ASn+2+Tf0kSuW0AIQkfGpjM=; b=mwh5yLlFkatyIKqT5z138xCX6/F3uiNIlqqqLQqjZ5iBjp6ImpQ+YIVXVeCdQ9WMMu jsuH4i1/VRBD0rLHaDrlKuT+huP9sLBPX0+hnz9hTLUQLCL4FzitdxCMmGdhJDeo9fkn qqTVIOY87XaUf0X0hIo46oO30e8I68MDIlj6Fq0C6YUR0lkdCi8nrUotHqVEtAzzswSt Qqhz6x+n2aDqbdpnKXW88ZAQfTQIJcUqvE6crflYVW+fnUi8sdSxCAKsyHOu/stniQlj HmtDSeKm9gAoWIsaD62/CVAsmvHyL1pHo70TO+85KjiopA1dTeQ6gfAaMsvu5VrJRLnI bHeQ== X-Gm-Message-State: AMCzsaW5n/MF/21RliVQYv+yFpFWPKE5QoWWTdie+83R9OEK8hfj5/i8 nXy3iowwjv7KQXpxGyG9HXGzqcWrxbI= X-Google-Smtp-Source: ABhQp+QGRI5j1F2ZF4bMwVvLzFBLkPGSqHPhs2uJOacxr/SF1rRuoukxrf8bp9uyDW7JqyaRyr99rg== X-Received: by 10.84.173.195 with SMTP id p61mr14194972plb.138.1509955676120; Mon, 06 Nov 2017 00:07:56 -0800 (PST) Received: from rfd.leadboat.com (c-73-158-248-138.hsd1.ca.comcast.net. [73.158.248.138]) by smtp.gmail.com with ESMTPSA id y197sm21546947pfg.103.2017.11.06.00.07.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 00:07:54 -0800 (PST) Date: Mon, 6 Nov 2017 00:07:52 -0800 From: Noah Misch To: pgsql-hackers@postgresql.org Subject: Race to build pg_isolation_regress in "make -j check-world" Message-ID: <20171106080752.GA1298146@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="wac7ysb48OaltWcw" Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I've been enjoying the speed of parallel check-world, but I get spurious failures from makefile race conditions. Commit c66b438 fixed the simple ones. More tricky is this problem of multiple "make" processes entering src/test/regress concurrently, which causes failures like these: gcc: error: pg_regress.o: No such file or directory make[4]: *** [pg_isolation_regress] Error 1 /bin/sh: ../../../src/test/isolation/pg_isolation_regress: Permission denied make -C test_extensions check make[2]: *** [check] Error 126 make[2]: Leaving directory `/home/nm/src/pg/backbranch/10/src/test/isolation' /bin/sh: ../../../../src/test/isolation/pg_isolation_regress: Text file busy make[3]: *** [isolationcheck] Error 126 make[3]: Leaving directory `/home/nm/src/pg/backbranch/10/src/test/modules/snapshot_too_old' This is reproducible since commit 2038bf4 or earlier; "make -j check-world" had worse problems before that era. A workaround is to issue "make -j; make -j -C src/test/isolation" before the check-world. This problem doesn't affect src/test/regress/pg_regress. Every top-level "make" or "make install", including temp-install, builds pg_regress. I tried fixing this by building src/test/isolation at the same times we run install-temp. Naturally, that didn't help installcheck-world. It also caused multiple "make" processes to enter src/port concurrently. I could fix both check-world and installcheck-world with the attached hack of building src/test/isolation during every top-level build or install. The problem of multiple "make" processes in a directory (especially src/port) shows up elsewhere. In a cleaned tree, "make -j -C src/bin" or "make -j installcheck-world" will do it. For more-prominent use cases, src/Makefile prevents this with ".NOTPARALLEL:" and building first the directories that are frequent submake targets. Perhaps we could fix the general problem with directory locking; targets that call "$(MAKE) -C FOO" would first sleep until FOO's lock is available. That could be tricky to make robust. For now, I propose back-patching the attached, sad hack. Better ideas? Thanks, nm --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="isolation-build-v1.patch" diff --git a/src/Makefile b/src/Makefile index 380da92..febbced 100644 --- a/src/Makefile +++ b/src/Makefile @@ -28,6 +28,7 @@ SUBDIRS = \ pl \ makefiles \ test/regress \ + test/isolation \ test/perl # There are too many interdependencies between the subdirectories, so diff --git a/src/test/isolation/Makefile b/src/test/isolation/Makefile index 8eb4969..efbdc40 100644 --- a/src/test/isolation/Makefile +++ b/src/test/isolation/Makefile @@ -15,6 +15,13 @@ OBJS = specparse.o isolationtester.o $(WIN32RES) all: isolationtester$(X) pg_isolation_regress$(X) +# Though we don't install these binaries, build them during installation +# (including temp-install). Otherwise, "make -j check-world" and "make -j +# installcheck-world" would spawn multiple, concurrent builds in this +# directory. Later builds would overwrite files while earlier builds are +# reading them, causing occasional failures. +install: | all + submake-regress: $(MAKE) -C $(top_builddir)/src/test/regress pg_regress.o --wac7ysb48OaltWcw Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --wac7ysb48OaltWcw--