solc-select icon indicating copy to clipboard operation
solc-select copied to clipboard

[Bug-Candidate]: retry HTTP 429 with exponential backoff and log error

Open wjmelements opened this issue 7 months ago • 2 comments

Describe the issue:

get_additional_linux_versions() can fail with HTTPError 429.

HTTP Error 429 should not be treated as a permanent failure. It should be retried with exponential backoff. The user should also be notified of the reason for this delay.

Code example to reproduce the issue:

pipenv run solc-select install 0.6.6 && pipenv run solc-select use 0.6.6

Version:

0.2.1

Relevant log output:

Run pipenv run solc-select install 0.6.6 && pipenv run solc-select use 0.6.6
Loading .env environment variables...
Traceback (most recent call last):
  File "/home/runner/.local/share/virtualenvs/<redacted>/bin/solc-select", line [8](https://github.com/<redacted>/<redacted>/actions/runs/<redacted>/job/<redacted>#step:22:9), in <module>
    sys.exit(solc_select())
             ^^^^^^^^^^^^^
  File "/home/runner/.local/share/virtualenvs/<redacted>/lib/python3.11/site-packages/solc_select/__main__.py", line 51, in solc_select
    install_artifacts(args.get(INSTALL_VERSIONS))
  File "/home/runner/.local/share/virtualenvs/<redacted>/lib/python3.11/site-packages/solc_select/solc_select.py", line 45, in install_artifacts
    releases = get_available_versions()
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.local/share/virtualenvs/<redacted>/lib/python3.11/site-packages/solc_select/solc_select.py", line 115, in get_available_versions
    available_releases.update(get_additional_linux_versions())
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.local/share/virtualenvs/<redacted>/lib/python3.11/site-packages/solc_select/solc_select.py", line 123, in get_additional_linux_versions
    github_json = urllib.request.urlopen(url).read()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 525, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 634, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 563, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/urllib/request.py", line 4[9](https://github.com/<redacted>/<redacted>/actions/runs/<redacted>/job/<redacted>#step:22:10)6, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.[11](https://github.com/<redacted>/<redacted>/actions/runs/<redacted>/job/<redacted>#step:22:12)/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 429: Too Many Requests

wjmelements avatar May 19 '25 22:05 wjmelements

Thanks for the report, it looks like the recent changes to GitHub rate limits are affecting solc-select

https://github.blog/changelog/2025-05-08-updated-rate-limits-for-unauthenticated-requests/

elopez avatar May 19 '25 22:05 elopez

#242 should help with these

elopez avatar Sep 09 '25 21:09 elopez