function `urlopen` without timeout argument timed out in certain situations
situation:
- manjaro 20.2.1
- pacman-mirrors Version 4.19.1
- a special network situation where the program can't connect to gitlab.manjaro.org and repo.manjaro.org, but can connect to bitbucket.org
Run sudo pacman-mirrors -c all
or sudo pacman-mirrors --status
. The program will time out, but won't print error messages, won't terminate, just stucked.
cause:
Being able to connect to bitbucket.org makes the program think the network is good, then it call urllib.request.urlopen(req)
in here (or many other urlopen
s) without timeout argument, causing it to time out.
why I think it should be fixed:
This could happen (it happend to me). I've seen complains about pacman-mirrors
been 'very slow'. I'll assume this happens to many users in my local area.
Even if the program can't download the latest mirrors.json/status.json, when /usr/share/pacman-mirrors/mirrors.json
exits and the network is up, pacman-mirrors still ranks mirror sites and writes to mirrorlist.
I would suggest adding more timeout=
, except timeout as e:
, etc.
Thanks for the hard work!