summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Westphahl <simon.westphahl@bmw.de>2023-02-01 13:11:01 +0100
committerSimon Westphahl <simon.westphahl@bmw.de>2023-02-01 13:11:01 +0100
commit1897ac4c6ff6669e569022bb9cab7f04575cec11 (patch)
treef94391053f715783bdec8e0902c2a4b81c32cc7f
parentc0985cff39e0ec2b9f7252e7d4a29e9979cda99f (diff)
downloadzuul-1897ac4c6ff6669e569022bb9cab7f04575cec11.tar.gz
Prevent files cache ltime from going backward
This fixes a race condition when two schedulers request files for the same repository at roughly the same time. The files cache ltime is generated before creating the cat job. We also cannot guarantee the order in which the job results are processed. Since we include the files cache ltime in the min. ltimes as part of the layout state we need to make sure that the timestamp of the cache doesn't go backward. This should fix the following exception we occassionally see in zuul-web: WARNING zuul.ConfigLoader: Zuul encountered an error while accessing the repo org/project. The error was: Configuration files missing from cache. Check Zuul scheduler logs for more information. Change-Id: I9fe2ed0b7a95dd12bb978273673e905d06bee72d
-rw-r--r--zuul/configloader.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/zuul/configloader.py b/zuul/configloader.py
index 7f8346382..1e7e010cc 100644
--- a/zuul/configloader.py
+++ b/zuul/configloader.py
@@ -2221,6 +2221,12 @@ class TenantParser(object):
job.source_context.branch)
with self.unparsed_config_cache.writeLock(
job.source_context.project_canonical_name):
+ # Prevent files cache ltime from going backward
+ if files_cache.ltime >= job.ltime:
+ self.log.info(
+ "Discarding job %s result since the files cache was "
+ "updated in the meantime", job)
+ continue
# Since the cat job returns all required config files
# for ALL tenants the project is a part of, we can
# clear the whole cache and then populate it with the