All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cooker: limit the execution of the hashequiv client/server ping
@ 2026-04-23 10:29 corentin.guillevic
  2026-04-23 11:50 ` [bitbake-devel] " Antonin Godard
  2026-04-27  8:51 ` Mathieu Dubois-Briand
  0 siblings, 2 replies; 3+ messages in thread
From: corentin.guillevic @ 2026-04-23 10:29 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Corentin Guillevic

From: Corentin Guillevic <corentin.guillevic@smile.fr>

The ping method is used to test the connection to the hash equivalence server.
However, if the server is unavailable, the bitbake server has to wait several
minutes for the system to terminate.

While waiting for a response from the hash server, the bitbake server does not
provide any feedback to the bitbake client. The latter then closes the link and
fails with the error:

Timeout while waiting for a reply from the bitbake server (60s at 09:50:15.377337)

Adding a timeout to the ping step allows quicker action when a remote server is
unavailable, and prevents disconnection of the client due to timeout.
The default timeout is 10 seconds, but this can be set using the
BB_HASHSERVER_TIMEOUT variable.

Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---
 lib/bb/asyncrpc/client.py | 4 ++--
 lib/bb/cooker.py          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/bb/asyncrpc/client.py b/lib/bb/asyncrpc/client.py
index 17b72033b..7ef76c90c 100644
--- a/lib/bb/asyncrpc/client.py
+++ b/lib/bb/asyncrpc/client.py
@@ -199,8 +199,8 @@ class AsyncClient(object):
         self.check_invoke_error(result)
         return result
 
-    async def ping(self):
-        return await self.invoke({"ping": {}})
+    async def ping(self, timeout):
+        return await asyncio.wait_for(self.invoke({"ping": {}}), timeout)
 
     async def __aenter__(self):
         return self
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 4b6ba3196..0bc9b7aec 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -342,7 +342,7 @@ according to https://docs.yoctoproject.org/dev-manual/hashequivserver.html""".fo
                 if upstream:
                     try:
                         with hashserv.create_client(upstream) as client:
-                            client.ping()
+                            client.ping(self.data.getVar("BB_HASHSERVER_TIMEOUT") or 10)
                     except ImportError as e:
                         bb.fatal(""""Unable to use hash equivalence server at '%s' due to missing or incorrect python module:
 %s
@@ -352,7 +352,7 @@ Please install the needed module on the build host, or use an environment contai
  - or set up pip venv
 You can also remove the BB_HASHSERVE_UPSTREAM setting, but this may result in significantly longer build times as bitbake will be unable to reuse prebuilt sstate artefacts."""
                                  % (upstream, repr(e)))
-                    except ConnectionError as e:
+                    except (ConnectionError, TimeoutError) as e:
                         bb.warn("Unable to connect to hash equivalence server at '%s', please correct or remove BB_HASHSERVE_UPSTREAM:\n%s"
                                  % (upstream, repr(e)))
                         upstream = None
-- 
2.51.0



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

end of thread, other threads:[~2026-04-27  8:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-23 10:29 [PATCH] cooker: limit the execution of the hashequiv client/server ping corentin.guillevic
2026-04-23 11:50 ` [bitbake-devel] " Antonin Godard
2026-04-27  8:51 ` Mathieu Dubois-Briand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.