diff options
author | Alejandro Hernandez Samaniego <alejandro@enedino.org> | 2021-02-19 11:28:17 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-02-26 17:47:56 +0000 |
commit | 255fdb9f7446808780f30a91a4061828b2ea9d03 (patch) | |
tree | eee05c5cf1f050497a49405b55c91803ed04be26 | |
parent | 5f69bf12e5af95a16546906c662ae046aef136c5 (diff) | |
download | poky-255fdb9f7446808780f30a91a4061828b2ea9d03.tar.gz |
bitbake: fetch2/wget: Avoid crashing when connection drops mid checkstatus
If an exception is raised when running host python code, the fetcher
immediately crashes, this might be temporary depending on the servers
reliability.
Catch the exception when the connection was reset and try once again
to fetch the data.
File: '/usr/lib/python3.8/socket.py', lineno: 669, function: readinto
0665: if self._timeout_occurred:
0666: raise OSError("cannot read from timed out object")
0667: while True:
0668: try:
*** 0669: return self._sock.recv_into(b)
0670: except timeout:
0671: self._timeout_occurred = True
0672: raise
0673: except error as e:
Exception: ConnectionResetError: [Errno 104] Connection reset by peer
(Bitbake rev: d0f5c5905bc664e415a05e3130dfe0ae541d8b3e)
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alhe@linux.microsoft.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/fetch2/wget.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 78a49676fe..6d82f3af07 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py | |||
@@ -332,6 +332,14 @@ class Wget(FetchMethod): | |||
332 | # debug for now to avoid spamming the logs in e.g. remote sstate searches | 332 | # debug for now to avoid spamming the logs in e.g. remote sstate searches |
333 | logger.debug2("checkstatus() urlopen failed: %s" % e) | 333 | logger.debug2("checkstatus() urlopen failed: %s" % e) |
334 | return False | 334 | return False |
335 | except ConnectionResetError as e: | ||
336 | if try_again: | ||
337 | logger.debug2("checkstatus: trying again") | ||
338 | return self.checkstatus(fetch, ud, d, False) | ||
339 | else: | ||
340 | # debug for now to avoid spamming the logs in e.g. remote sstate searches | ||
341 | logger.debug2("checkstatus() urlopen failed: %s" % e) | ||
342 | return False | ||
335 | return True | 343 | return True |
336 | 344 | ||
337 | def _parse_path(self, regex, s): | 345 | def _parse_path(self, regex, s): |