Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mirrors.txt only has a single mirror to choose from #62

Closed
dangpzanco opened this issue Jun 2, 2017 · 6 comments
Closed

mirrors.txt only has a single mirror to choose from #62

dangpzanco opened this issue Jun 2, 2017 · 6 comments
Labels

Comments

@dangpzanco
Copy link

http://mirrors.ubuntu.com/mirrors.txt only contains a single mirror:
http://archive.ubuntu.com/ubuntu/

Please update the script to check the current country's file, which contain much more mirrors, for example:
Brazil - http://mirrors.ubuntu.com/BR.txt
USA - http://mirrors.ubuntu.com/US.txt
France - http://mirrors.ubuntu.com/FR.txt

@jblakeman
Copy link
Owner

jblakeman commented Jun 3, 2017

Thanks for reporting. My guess is that this was either an unannounced deprecation or incidental recent change by the mirrors.ubuntu.com admins. Perhaps the IP lookup database the server used to render the correct list by country is failing.

This pretty much breaks the tool. The logical fix is just to parse https://launchpad.net/ubuntu/+archivemirrors or fetch the country lists as you've suggested, though I'm not sure of the most reliable way to choose the country. I don't think we want to spawn 438 440 threads to test latency (total number of mirrors across all countries). There's the file /var/lib/mirrors/mirrors.ubuntu.com_mirrors.txt we could look for but I don't think that would be reliable.

I'll try to do some research and take some time to fix this in the next week. I've been busy with other things and haven't been able to maintain this tool much at all over the past year, but will try to make a concerted effort to fix this one given the urgency.

@jblakeman jblakeman added the bug label Jun 3, 2017
@imatimba
Copy link

imatimba commented Jun 4, 2017

You could use the lists with the country code creating a new argument to specify the country.
I changed the mirror url on main.py to http://mirrors.ubuntu.com/US.txt and works fine.

@jblakeman
Copy link
Owner

I should have been more clear in the last comment. The problem I'm wondering about how to best solve is how would the default country be selected if none is provided via the command line?

@imatimba
Copy link

imatimba commented Jun 4, 2017

Make it mandatory or show a warning about it and default to US.
I would go with making it mandatory. You could show the list of available countries and let the user pick if he doesn't specify it manually with the argument.

@jblakeman
Copy link
Owner

jblakeman commented Jun 4, 2017

Perhaps a requirement is the best option. It certainly is a straight forward fix, but would be a breaking change.

One alternative I'm thinking about is to test all mirrors regardless of country if no country argument is passed. There would have to be some considerations of the available memory (perhaps psutil.virtual_memory().available) vs. the calculated data size of all threads. Once that's determined, thread sets could be split into chunks and joined in sequence to avoid overwhelming system memory by starting too many threads at once.

@jblakeman
Copy link
Owner

jblakeman commented Jun 5, 2017

I'll start working on a fix that adds a --country argument, defaulting to US if not provided.

Follow up enhancements can be made to improve the default behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants