Skip to contentSkip to conversation

fetch/wget: Add timeout for checkstatus calls (15s)

PATCH New Richard Purdie 1 participant 1 message Nov 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch/wget: Add timeout for checkstatus calls (15s)

We had an issue where a webserver serving sstate had filesystem issues so would accept connections but effectively not do anything with them. This causes bitbake to hang whilst processing things like sstate objects inside the checkstatus() calls. It can be replicated by setting up a server like:

socat -u TCP4-LISTEN:NNN,fork OPEN:/dev/null

and pointing SSTATE_MIRRORS in OE at that address.

Adding a timeout to the checkstatus calls of 15s means that whilst the system will pause, it will then continue and not hang entirely. Since there isn't a large transfer here, 15s seems a reasonable response time after which we should fall back to building things ourselves.

[YOCTO #13716]

---
 lib/bb/fetch2/wget.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/wget.py +1 -1
index 349891e852..743f73cfd4 100644
@@ -356,7 +356,7 @@ class Wget(FetchMethod):
                 except (TypeError, ImportError, IOError, netrc.NetrcParseError):
                     pass
 
-                with opener.open(r) as response:
+                with opener.open(r, timeout=15) as response:
                     pass
             except urllib.error.URLError as e:
                 if try_again:
Signature · 1 line
2.32.0