galaxy: Sometimes a lot of HTTP status codes 520 when accessing Galaxy API
Bug Report
SUMMARY
I’m working on the Ansible changelog / porting guide build (ansible-community/antsibull#103). Both that build, and the ACD build itself, are querying the Galaxy API for all included collections (~60 of them). It often happens to me that I get a lot of 520 HTTP status codes (seems to be a Cloudflare internal error code):
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/community/azure/versions/0.1.0/', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/community/azure/versions/0.1.0/', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/cisco/nxos/versions/?format=json&page=2', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/google/cloud/versions/0.10.1/', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/cisco/ios/versions/?format=json&format=json&format=json&page=4', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/junipernetworks/junos/versions/?format=json&format=json&format=json&format=json&page=5', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/cisco/ios/versions/?format=json&format=json&format=json&page=4', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/vyos/vyos/versions/?format=json&format=json&format=json&format=json&page=5', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/junipernetworks/junos/versions/?format=json&format=json&format=json&format=json&page=5', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/community/vmware/versions/?format=json&format=json&page=3', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/community/vmware/versions/?format=json&format=json&page=3', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/arista/eos/versions/?format=json&format=json&format=json&format=json&format=json&format=json&page=7', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/cisco/ios/versions/?format=json&format=json&format=json&page=4', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/cisco/nxos/versions/?format=json&format=json&format=json&page=4', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/cisco/iosxr/versions/?format=json&format=json&format=json&format=json&page=5', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/community/vmware/versions/?format=json&format=json&page=3', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/cisco/iosxr/versions/?format=json&format=json&format=json&format=json&page=5', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/cisco/nxos/versions/?format=json&format=json&format=json&format=json&page=5', params={'format': 'json'}) failed with status code 520, retrying...
WARNING: aio_session.get('https://galaxy.ansible.com/api/v2/collections/community/vmware/versions/?format=json&format=json&page=3', params={'format': 'json'}) failed with status code 520, retrying...
After adding code to retry the requests (with some increasing delay), it finally almost always completes (before I had to run it 2-10 times until it completed).
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (6 by maintainers)
Commits related to this issue
- Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. — committed to felixfontein/community.routeros by felixfontein 3 years ago
- Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. — committed to felixfontein/community.hrobot by felixfontein 3 years ago
- Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. — committed to felixfontein/community.crypto by felixfontein 3 years ago
- Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. — committed to felixfontein/community.docker by felixfontein 3 years ago
- Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. — committed to felixfontein/community.docker by felixfontein 3 years ago
- Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. (#211) — committed to ansible-collections/community.crypto by felixfontein 3 years ago
- Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. (#11) — committed to ansible-collections/community.hrobot by felixfontein 3 years ago
- Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. (#24) — committed to ansible-collections/community.routeros by felixfontein 3 years ago
- Stop using ansible-galaxy collection install to install a collection due to https://github.com/ansible/galaxy/issues/2429. (#113) — committed to ansible-collections/community.docker by felixfontein 3 years ago
- CI: increase Ansible Galaxy retries & add delay We still see flakiness when downloading content from Ansible Galaxy, often HTTP 520. This change increases the retries from 3 to 10, and adds a 5 secon... — committed to openstack/kayobe by markgoddard 3 years ago
- Update git submodules * Update kayobe from branch 'master' to 557f4f1ad3f275a0623b9663c3cc5557ef3559ea - Merge "CI: increase Ansible Galaxy retries & add delay" - CI: increase Ansible Galaxy re... — committed to openstack/openstack by deleted user 3 years ago
- CI: increase Ansible Galaxy retries & add delay We still see flakiness when downloading content from Ansible Galaxy, often HTTP 520. This change increases the retries from 3 to 10, and adds a 5 secon... — committed to openstack/kayobe by markgoddard 3 years ago
- CI: increase Ansible Galaxy retries & add delay We still see flakiness when downloading content from Ansible Galaxy, often HTTP 520. This change increases the retries from 3 to 10, and adds a 5 secon... — committed to openstack/kayobe by markgoddard 3 years ago
- CI: increase Ansible Galaxy retries & add delay We still see flakiness when downloading content from Ansible Galaxy, often HTTP 520. This change increases the retries from 3 to 10, and adds a 5 secon... — committed to openstack/kayobe by markgoddard 3 years ago
We’ve doubled the rate limit from 10 requests per second to 20 as a temporary fix and there’s an issue for
ansible-galaxy
to correctly handle situations where it gets rate limited: https://github.com/ansible/ansible/issues/74191Sadly galaxy install CLI does not have retry mechanism included in it, which I see as a bug (not missing feature…). Just yesterday I had to implement retry mechanism in ansible-lint specially as it was randomly failing to install collections.
Network operations can fail and will fail, we better have an option in galaxy CLI to retry at least twice. This will likely avoid most glitches.
Hmm, I was assuming that
ansible-galaxy collection install
would use a larger page size. Or is that only implemented in stable-2.11 / devel? But anyway, having retries and a more efficient API would really help a lot…