From 3abe774d83ee4b92127f5f95fbec821c34ac872f Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 27 Aug 2024 15:25:39 -0400 Subject: [PATCH] sync: add a 5 second timeout to gemato's openpgp refresh If it takes more than 5 seconds to download a miniscule file from https://gentoo.org/.well-known/openpgpkey/ then something has gone dreadfully wrong. Most commonly, what went wrong is that the user has broken ipv6 connectivity and requests simply hangs forever (no joke -- it doesn't implement Happy Eyeballs and closed the multiple bug reports as "please use stackoverflow to ask questions about how to use requests, we are not a support forum"). Pass a timeout so that we eventually give up and try ipv4 instead. This is a crude hack and the proper solution is to make gemato handle this better, but until gemato is fixed to use a better download library we do the best we can. Bug: https://github.com/psf/requests/issues/6788 Bug: https://github.com/projg2/gemato/issues/35 Bug: https://bugs.gentoo.org/779766 --- lib/portage/sync/syncbase.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/sync/syncbase.py b/lib/portage/sync/syncbase.py index c3a07da7d7..5c0bfc9acc 100644 --- a/lib/portage/sync/syncbase.py +++ b/lib/portage/sync/syncbase.py @@ -340,11 +340,11 @@ def _get_openpgp_env(self, openpgp_key_path=None, debug=False): if openpgp_key_path: openpgp_env = gemato.openpgp.OpenPGPEnvironment( - proxy=proxy, debug=debug + proxy=proxy, debug=debug, timeout=5 ) else: openpgp_env = gemato.openpgp.OpenPGPSystemEnvironment( - proxy=proxy, debug=debug + proxy=proxy, debug=debug, timeout=5 ) return openpgp_env