From: ecordonnier@snap.com
To: bitbake-devel@lists.openembedded.org
Cc: Sebastian Muxel <smuxel@snap.com>,
Etienne Cordonnier <ecordonnier@snap.com>,
Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>,
Richard Purdie <richard.purdie@linuxfoundation.org>
Subject: [2.8][PATCH] fetch2/gcp: treat GatewayTimeout as fetch failure
Date: Mon, 31 Aug 2026 10:40:31 +0200 [thread overview]
Message-ID: <20260831084031.200351-1-ecordonnier@snap.com> (raw)
From: Sebastian Muxel <smuxel@snap.com>
blob.exists() and blob.download_to_filename() can raise
google.api_core.exceptions.GatewayTimeout after the GCS client's own
retries. Uncaught, that escapes as a hard error instead of a normal
fetch/checkstatus failure (and blocks mirror fallback on download).
Catch GatewayTimeout in checkstatus() and download(), log a warning so
the timeout is visible, and raise FetchError.
AI-Generated: Cursor with Grok 4.5
Signed-off-by: Sebastian Muxel <smuxel@snap.com>
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry-picked from commit 251f01e9afa1dcb9a49f8a31981e698017a43754)
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
---
lib/bb/fetch2/gcp.py | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/lib/bb/fetch2/gcp.py b/lib/bb/fetch2/gcp.py
index 2ee9ed219..c3cbc948f 100644
--- a/lib/bb/fetch2/gcp.py
+++ b/lib/bb/fetch2/gcp.py
@@ -57,7 +57,7 @@ class GCP(FetchMethod):
Fetch urls using the GCP API.
Assumes localpath was called first.
"""
- from google.api_core.exceptions import NotFound
+ from google.api_core.exceptions import GatewayTimeout, NotFound
logger.debug2(f"Trying to download gs://{ud.host}{ud.path} to {ud.localpath}")
if self.gcp_client is None:
self.get_gcp_client()
@@ -71,6 +71,13 @@ class GCP(FetchMethod):
blob.download_to_filename(ud.localpath)
except NotFound:
raise FetchError("The GCP API threw a NotFound exception")
+ except GatewayTimeout as e:
+ # The GCS client already retries GatewayTimeout internally.
+ # Raise FetchError so mirror fallback can proceed.
+ logger.warning(
+ f"GCP API GatewayTimeout while downloading gs://{ud.host}{ud.path}: {e}"
+ )
+ raise FetchError(f"Transient GCP API GatewayTimeout for gs://{ud.host}{ud.path}")
# Additional sanity checks copied from the wget class (although there
# are no known issues which mean these are required, treat the GCP API
@@ -88,6 +95,8 @@ class GCP(FetchMethod):
"""
Check the status of a URL.
"""
+ from google.api_core.exceptions import GatewayTimeout
+
logger.debug2(f"Checking status of gs://{ud.host}{ud.path}")
if self.gcp_client is None:
self.get_gcp_client()
@@ -96,7 +105,18 @@ class GCP(FetchMethod):
# Path sometimes has leading slash, so strip it
path = ud.path.lstrip("/")
- if self.gcp_client.bucket(ud.host).blob(path).exists() == False:
+ try:
+ exists = self.gcp_client.bucket(ud.host).blob(path).exists()
+ except GatewayTimeout as e:
+ # The GCS client already retries GatewayTimeout internally.
+ # Surface a normal checkstatus failure and warn so the timeout
+ # is visible to operators.
+ logger.warning(
+ f"GCP API GatewayTimeout while checking gs://{ud.host}{ud.path}; treating as unavailable: {e}"
+ )
+ raise FetchError(f"Transient GCP API GatewayTimeout for gs://{ud.host}{ud.path}")
+
+ if exists == False:
raise FetchError(f"The GCP API reported that gs://{ud.host}{ud.path} does not exist")
else:
return True
--
2.43.0
reply other threads:[~2026-08-31 8:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831084031.200351-1-ecordonnier@snap.com \
--to=ecordonnier@snap.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=richard.purdie@linuxfoundation.org \
--cc=smuxel@snap.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox