@@ -506,6 +506,7 @@ def setup_tools_tarball(ourconfig, btdir, bttarball, name="buildtools"):
# previous build. tarball_updated is set to True whenever the cached
# download is replaced, which triggers removal of the stale btdir.
tarball_updated = False
+ tarball_timeout = time.monotonic() + 300 # 5 min, tune as needed
while True:
try:
with open(btlock, 'a+') as lf:
@@ -548,7 +549,10 @@ def setup_tools_tarball(ourconfig, btdir, bttarball, name="buildtools"):
break
except OSError:
# We raced with someone else, try again
- pass
+ if time.monotonic() > tarball_timeout:
+ raise
+ time.sleep(1)
+
# If the underlying tarball changed, remove any stale extraction
# directory so it is re-extracted below.
if tarball_updated and os.path.exists(btdir):
The while True, try, except OSError: pass loop has a risk of getting caught in an infinite loop. Add an overall timeout to ensure we raise the underlying OSError after we have tried for 300 seconds/5 minutes. Signed-off-by: Tim Orling <tim.orling@konsulko.com> --- scripts/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)