From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7115378279577550848 X-Received: by 2002:adf:ea08:0:b0:21d:6dbf:6366 with SMTP id q8-20020adfea08000000b0021d6dbf6366mr1040612wrm.137.1656923164445; Mon, 04 Jul 2022 01:26:04 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6000:184a:b0:21d:2802:2675 with SMTP id c10-20020a056000184a00b0021d28022675ls21216980wri.1.gmail; Mon, 04 Jul 2022 01:26:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v3idGlwEbYUrJlmmdGPFYuS6J/rI14iuhD5noT4b4X+wneeLE5gbl4xT0niTuc9dVUsVs5 X-Received: by 2002:a5d:5951:0:b0:21b:9480:1696 with SMTP id e17-20020a5d5951000000b0021b94801696mr26886266wri.350.1656923163290; Mon, 04 Jul 2022 01:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656923163; cv=none; d=google.com; s=arc-20160816; b=IwC1x5NxLvaBgLSYGqvJYvW0kPy76BpNClXYQA/Yr7PdOP+h1ImmFRpx0qNC8q0GIC ybFJBTV1L/tGnoPpf0Ev6Li48r/rji6KTrOH8/rY0msrFkV4SdUwhzxXVfgqiXeHX54Y y8JpoRcsNJMQEeFg/oBLnzr8dI5Ajjn+Qs50KaUDV178ul4XgguFZL3oM4t9UbIJXtHm EfH2UlPDKGP4la0Lh6SqasD2QrGPKJ0iwSI22jgEs2qqVdCFA46vRdcQQovY/qNsMr6P GlGTg2JgfHwCxwf3UkmzvYQmodkoO8MadaC+i/iCjm6YDTe1FB6ytVd68pTC1rznhEMh dHUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from; bh=lC2pGUoFohhTP04oeGxIL7fNrLn4gVRFIeZafFWsZDA=; b=yCcTzQ0dnJ65YIUkU6d9qY4aUpXsPXnCXR9ATJe7NRmmUagViB+iBzSHWhpb9ijwBF F3CEDJ4YTSIuH1c4GGyABmyuKbTYHSSqbnrlK1uswh1zSWjnKokMfr0Dgcr77dmjrW97 yLIUm10pfJglmtNwRqGr/HRqePIiMF/tjZ9nj39d/6QriY+J5z/1UbI+VPEAhp803m9U WACEXwlfic9nrQGnLQxCx+xqGD+HO9wVFT9YEQyka/dPY90MVz3Fy+0iK0+qIsjYxyre IHj5Ui+0MLDwT0Kmw9OMaxpOSiJvD6q/DbHlrdq4j1eZvTxxU81Zdb/6NMKhi/9tg7Cn 5n2Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id bj6-20020a0560001e0600b0021d60ea7130si229090wrb.0.2022.07.04.01.26.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jul 2022 01:26:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from home.localnet (44-208-124-178-static.mgts.by [178.124.208.44] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPSA id 2648Q15U002524 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 4 Jul 2022 10:26:02 +0200 From: Uladzimir Bely To: isar-users@googlegroups.com, Felix Moessbauer Subject: Re: [PATCH v2 1/1] add uuid to schroot folder instead of pid Date: Mon, 04 Jul 2022 11:25:56 +0300 Message-ID: <25497722.1r3eYUQgxm@home> In-Reply-To: <20220701145956.3855135-2-felix.moessbauer@siemens.com> References: <20220701145956.3855135-1-felix.moessbauer@siemens.com> <20220701145956.3855135-2-felix.moessbauer@siemens.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: IQQoxzkyMgat In the email from Friday, 1 July 2022 17:59:56 +03 user Felix Moessbauer wrote: > PIDs are not unique across containers. > When running the build in a container (e.g. the kas container), > the PID of bitbake is likely the same across multiple simultaneously > running builds. > > This is especially the case for CI runners, where it is common that > multiple jobs run in parallel. > > This patch replaces the PID component by a random UUID that is injected > from the ISAR environment. > > Signed-off-by: Felix Moessbauer > --- > meta/classes/sbuild.bbclass | 2 +- > meta/conf/bitbake.conf | 7 ++++++- > scripts/isar-buildenv-internal | 4 +++- > 3 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/meta/classes/sbuild.bbclass b/meta/classes/sbuild.bbclass > index f9bfaaf6..03917533 100644 > --- a/meta/classes/sbuild.bbclass > +++ b/meta/classes/sbuild.bbclass > @@ -23,7 +23,7 @@ python __anonymous() { > d.setVar('SCHROOT_DEP', dep) > } > > -SBUILD_CHROOT ?= "${DEBDISTRONAME}-${SCHROOT_USER}-${@os.getpid()}" > +SBUILD_CHROOT ?= > "${DEBDISTRONAME}-${SCHROOT_USER}-${PN}-${ISAR_BUILD_UUID}" > Hi. I think, we could add UUID, but should not remove os.getpid(). If several build tasks (e.g., several "hello" for different architectures) are executed in parallel, they should be done under different schroot configurations. Using the same UUID will break the build. > SBUILD_CONF_DIR ?= "${SCHROOT_CONF}/${SBUILD_CHROOT}" > SCHROOT_CONF_FILE ?= "${SCHROOT_CONF}/chroot.d/${SBUILD_CHROOT}" > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf > index 6451cb59..31e11569 100644 > --- a/meta/conf/bitbake.conf > +++ b/meta/conf/bitbake.conf > @@ -104,7 +104,7 @@ BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD > BB_TASKHASH BBPATH BBSERVER DL_DI WORKDIR STAMPCLEAN PKGDATA_DIR BUILD_ARCH > SSTATE_PKGARCH \ > BB_WORKERCONTEXT BB_LIMITEDDEPS DEPLOY_DIR BUILDCHROOT_DIR \ > REPO_ISAR_DIR REPO_ISAR_DB_DIR REPO_BASE_DIR REPO_BASE_DB_DIR > LAYERDIR_core \ - SCRIPTSDIR TOPDIR" > + SCRIPTSDIR TOPDIR ISAR_BUILD_UUID" > BB_HASHCONFIG_WHITELIST ?= "${BB_HASHBASE_WHITELIST} DATE TIME > SSH_AGENT_PID \ SSH_AUTH_SOCK PSEUDO_BUILD BB_ENV_EXTRAWHITE > DISABLE_SANITY_CHECKS \ BB_NUMBER_THREADS BB_ORIGENV BB_INVALIDCONF > BBINCLUDED \ > @@ -134,6 +134,11 @@ USE_CCACHE ??= "0" > CCACHE_TOP_DIR ?= "${TMPDIR}/ccache" > CCACHE_DIR ?= "${CCACHE_TOP_DIR}/${DISTRO}-${DISTRO_ARCH}" > > +# Unique ID for this build, used to avoid name clashes on external > mountpoints +# When running parallel builds in different PID namespaces, > overwrite +# this with a globally unique value (e.g. by injecting a UUID > from the environment) +ISAR_BUILD_UUID ??= "none" > + > include conf/local.conf > include conf/multiconfig/${BB_CURRENT_MC}.conf > include conf/machine/${MACHINE}.conf > diff --git a/scripts/isar-buildenv-internal b/scripts/isar-buildenv-internal > index ec8e4377..e5cb5364 100755 > --- a/scripts/isar-buildenv-internal > +++ b/scripts/isar-buildenv-internal > @@ -62,6 +62,8 @@ export BUILDDIR > export BITBAKEDIR="${ISARROOT}/bitbake" > export SCRIPTSDIR="${ISARROOT}/scripts" > export TESTSUITEDIR="${ISARROOT}/testsuite" > +# use builtin python uuid to avoid dep to uuidgen > +export ISAR_BUILD_UUID="$(python3 -c 'import uuid; > print(str(uuid.uuid4()))')" > > for newpath in "$BITBAKEDIR/bin" "$SCRIPTSDIR"; do > # Remove any existences of $newpath from $PATH > @@ -77,5 +79,5 @@ export PATH > BBPATH="${BUILDDIR}" > export BBPATH > > -BB_ENV_EXTRAWHITE="BITBAKEDIR SCRIPTSDIR TESTSUITEDIR http_proxy > https_proxy ftp_proxy no_proxy GNUPGHOME" +BB_ENV_EXTRAWHITE="BITBAKEDIR > SCRIPTSDIR TESTSUITEDIR http_proxy https_proxy ftp_proxy no_proxy GNUPGHOME > ISAR_BUILD_UUID" export BB_ENV_EXTRAWHITE -- Uladzimir Bely