public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 1/1] isar-apt: fix race-condition in do_cache_config
@ 2026-06-03 11:46 'Felix Moessbauer' via isar-users
  2026-06-03 11:56 ` 'MOESSBAUER, Felix' via isar-users
  2026-06-05 14:24 ` Anton Mikanovich
  0 siblings, 2 replies; 5+ messages in thread
From: 'Felix Moessbauer' via isar-users @ 2026-06-03 11:46 UTC (permalink / raw)
  To: isar-users; +Cc: Felix Moessbauer

Repo configuration operations on the isar apt have to happen while
holding the isar lock. However, bitbake executes the cleandirs operation
without holding the lock, introducing a race-condition that sporadically
breaks the build with the following error:

  Error opening config file '/isar/build/tmp/deploy/isar-apt/
  debian-trixie/apt/debian-trixie/conf/distributions': No such file
  or directory(2)

We fix this by open-coding the cleandirs logic inside the function and
by that under the lock.

Fixes: be290896 ("isar-apt: support further optional fields ...")
Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
Note, that I was able to reliably produce this with the sbom test:
./scripts/run-tests.sh -t sbom

Best regards,
Felix

 meta/recipes-devtools/isar-apt/isar-apt.bb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/isar-apt/isar-apt.bb b/meta/recipes-devtools/isar-apt/isar-apt.bb
index e824bf1d..4ecbdb82 100644
--- a/meta/recipes-devtools/isar-apt/isar-apt.bb
+++ b/meta/recipes-devtools/isar-apt/isar-apt.bb
@@ -10,11 +10,15 @@ SRC_URI = "file://distributions.in"
 
 do_cache_config[lockfiles] = "${REPO_ISAR_DIR}/isar.lock"
 do_cache_config[vardeps] += "ISAR_APT_OPT_FIELD"
-do_cache_config[cleandirs] += "${REPO_ISAR_DIR}/${DISTRO}/conf"
 
 # Generate reprepro config for current distro if it doesn't exist. Once it's
 # generated, this task should do nothing.
 do_cache_config() {
+    # this part must be executed while holding the isar.lock, hence do not move
+    # it to cleandirs (these are executed without holding the lock)
+    rm -rf ${REPO_ISAR_DIR}/${DISTRO}/conf
+    mkdir -p ${REPO_ISAR_DIR}/${DISTRO}/conf
+
     repo_create "${REPO_ISAR_DIR}"/"${DISTRO}" \
         "${REPO_ISAR_DB_DIR}"/"${DISTRO}" \
         "${DEBDISTRONAME}" \
-- 
2.53.0

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20260603114618.3291059-1-felix.moessbauer%40siemens.com.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] isar-apt: fix race-condition in do_cache_config
  2026-06-03 11:46 [PATCH 1/1] isar-apt: fix race-condition in do_cache_config 'Felix Moessbauer' via isar-users
@ 2026-06-03 11:56 ` 'MOESSBAUER, Felix' via isar-users
  2026-06-04  9:39   ` Anton Mikanovich
  2026-06-05 14:24 ` Anton Mikanovich
  1 sibling, 1 reply; 5+ messages in thread
From: 'MOESSBAUER, Felix' via isar-users @ 2026-06-03 11:56 UTC (permalink / raw)
  To: isar-users

On Wed, 2026-06-03 at 13:46 +0200, Felix Moessbauer wrote:
> Repo configuration operations on the isar apt have to happen while
> holding the isar lock. However, bitbake executes the cleandirs operation
> without holding the lock, introducing a race-condition that sporadically
> breaks the build with the following error:
> 
>   Error opening config file '/isar/build/tmp/deploy/isar-apt/
>   debian-trixie/apt/debian-trixie/conf/distributions': No such file
>   or directory(2)
> 
> We fix this by open-coding the cleandirs logic inside the function and
> by that under the lock.
> 
> Fixes: be290896 ("isar-apt: support further optional fields ...")

PS: Commit "Revert "Split up isar-apt into distro-arch specific
instances" probably made it much more likely to run into the race-
condition, but the race was there before.

Felix

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/637973be3794202fa627f6026e8a826275d68670.camel%40siemens.com.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] isar-apt: fix race-condition in do_cache_config
  2026-06-03 11:56 ` 'MOESSBAUER, Felix' via isar-users
@ 2026-06-04  9:39   ` Anton Mikanovich
  2026-06-05 14:22     ` Anton Mikanovich
  0 siblings, 1 reply; 5+ messages in thread
From: Anton Mikanovich @ 2026-06-04  9:39 UTC (permalink / raw)
  To: isar-users, Felix Moessbauer

03.06.2026 14:56, 'MOESSBAUER, Felix' via isar-users wrote:
> PS: Commit "Revert "Split up isar-apt into distro-arch specific
> instances" probably made it much more likely to run into the race-
> condition, but the race was there before.
>
> Felix
>
Hello Felix,

Thanks for the fix.
It looks like the patch is working, but on the full CI other issue observed.
Don't think it is related, but rechecking will take some time.

Just in case, here is the failure during do_rootfs_install task of
isar-image-base recipe for virtualbox-bullseye target:

dpkg: error processing archive 
/tmp/apt-dpkg-install-rJzE6r/16-example-raw_0.3_all.deb (--unpack):
cannot access archive 
'/tmp/apt-dpkg-install-rJzE6r/16-example-raw_0.3_all.deb': No such file 
or directory

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/d66bb0d7-ec11-45b4-8ab1-99c33c9c05c2%40ilbers.de.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] isar-apt: fix race-condition in do_cache_config
  2026-06-04  9:39   ` Anton Mikanovich
@ 2026-06-05 14:22     ` Anton Mikanovich
  0 siblings, 0 replies; 5+ messages in thread
From: Anton Mikanovich @ 2026-06-05 14:22 UTC (permalink / raw)
  To: isar-users, Felix Moessbauer

04.06.2026 12:39, Anton Mikanovich wrote:
> Hello Felix,
>
> Thanks for the fix.
> It looks like the patch is working, but on the full CI other issue 
> observed.
> Don't think it is related, but rechecking will take some time.
>
> Just in case, here is the failure during do_rootfs_install task of
> isar-image-base recipe for virtualbox-bullseye target:
>
> dpkg: error processing archive 
> /tmp/apt-dpkg-install-rJzE6r/16-example-raw_0.3_all.deb (--unpack):
> cannot access archive 
> '/tmp/apt-dpkg-install-rJzE6r/16-example-raw_0.3_all.deb': No such 
> file or directory
>
Ok, I've found the reason of one more race in do_rootfs_install:
Apt-get don't cache debs from isar-apt (because of file:// scheme) to
/var/cache/apt/archives, so our isar-apt locking on 
rootfs_install_pkgs_download
don't really work.
Will merge this fix and prepare the next fix for do_rootfs_install soon.

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/b2f4f983-6dc8-4f7c-ae41-4e5e6a3c0319%40ilbers.de.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] isar-apt: fix race-condition in do_cache_config
  2026-06-03 11:46 [PATCH 1/1] isar-apt: fix race-condition in do_cache_config 'Felix Moessbauer' via isar-users
  2026-06-03 11:56 ` 'MOESSBAUER, Felix' via isar-users
@ 2026-06-05 14:24 ` Anton Mikanovich
  1 sibling, 0 replies; 5+ messages in thread
From: Anton Mikanovich @ 2026-06-05 14:24 UTC (permalink / raw)
  To: Felix Moessbauer, isar-users

03.06.2026 14:46, 'Felix Moessbauer' via isar-users wrote:
> Repo configuration operations on the isar apt have to happen while
> holding the isar lock. However, bitbake executes the cleandirs operation
> without holding the lock, introducing a race-condition that sporadically
> breaks the build with the following error:
>
>    Error opening config file '/isar/build/tmp/deploy/isar-apt/
>    debian-trixie/apt/debian-trixie/conf/distributions': No such file
>    or directory(2)
>
> We fix this by open-coding the cleandirs logic inside the function and
> by that under the lock.
>
> Fixes: be290896 ("isar-apt: support further optional fields ...")
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
Applied to next, thanks.

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/48b3b73d-00fd-4b3a-97e8-7bb2515036cc%40ilbers.de.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-05 14:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-03 11:46 [PATCH 1/1] isar-apt: fix race-condition in do_cache_config 'Felix Moessbauer' via isar-users
2026-06-03 11:56 ` 'MOESSBAUER, Felix' via isar-users
2026-06-04  9:39   ` Anton Mikanovich
2026-06-05 14:22     ` Anton Mikanovich
2026-06-05 14:24 ` Anton Mikanovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox