diff mbox series

[bitbake-devel,1/2] wget.py: Add catch TimeoutError exception

Message ID 20230309225221.273750-2-mark.hatle@kernel.crashing.org
State New
Headers show
Series Add fetch2 wget exception handler | expand

Commit Message

Mark Hatle March 9, 2023, 10:52 p.m. UTC
We've observed TimeoutError exceptions during the sstate-cache mirror fetch,
it appears that due to the number of (invalid) files requested the remote
side is eventually dropping the connection (not closing it) which can result
in a TimeoutError exception being sent, while rate it is different from the
urllib.error.URLError or ConnectionResetError.

Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
 bitbake/lib/bb/fetch2/wget.py | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 859b4f99e2d..927487a0b66 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -385,6 +385,14 @@  class Wget(FetchMethod):
                     # debug for now to avoid spamming the logs in e.g. remote sstate searches
                     logger.debug2("checkstatus() urlopen failed: %s" % e)
                     return False
+            except TimeoutError as e:
+                if try_again:
+                    logger.debug2("checkstatus: trying again")
+                    return self.checkstatus(fetch, ud, d, False)
+                else:
+                    # debug for now to avoid spamming the logs in e.g. remote sstate searches
+                    logger.debug2("checkstatus() urlopen TimeoutError: %s" % e)
+                    return False
 
         return True