bytecodealliance / bytecodealliance/setup-wasi-sdk-action

Auto-retry on download failure

Open
#22 2 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
0
Forks
2
Avg merge
7h 19m
Merged PRs (30d)
6

Description

GIven the flaky network of github actions, would it be reasonable ot include auto-retry behavior in this action? One example is this log -- https://github.com/bytecodealliance/wasm-tools/actions/runs/32513001088/job/96868224001?pr=2616 -- which failed as:

```
INFO:install.py:Downloading https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-34-rc.3/wasi-sdk-34.0-rc.3-x86_64-linux.tar.gz
DEBUG:install.py:Cleaned up temporary file /tmp/tmptyddpugc
Traceback (most recent call last):
File "/usr/lib/python3.12/urllib/request.py", line 1344, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/usr/lib/python3.12/http/client.py", line 1365, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.12/http/client.py", line 1411, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.12/http/client.py", line 1360, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.12/http/client.py", line 1120, in _send_output
self.send(msg)
File "/usr/lib/python3.12/http/client.py", line 1064, in send
self.connect()
File "/usr/lib/python3.12/http/client.py", line 1506, in connect
self.sock = self._context.wrap_socket(self.sock,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/ssl.py", line 1042, in _create
self.do_handshake()
File "/usr/lib/python3.12/ssl.py", line 1320, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/runner/work/_actions/bytecodealliance/setup-wasi-sdk-action/v1/install.py", line 360, in
main(args.version, args.install_dir, args.add_to_path)
File "/home/runner/work/_actions/bytecodealliance/setup-wasi-sdk-action/v1/install.py", line 324, in main
clang_path, sysroot_path = install(url, install_dir, expected_digest)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/_actions/bytecodealliance/setup-wasi-sdk-action/v1/install.py", line 245, in install
request.urlretrieve(url, archive_file.name)
File "/usr/lib/python3.12/urllib/request.py", line 240, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 521, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 630, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 553, in error
result = self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 745, in http_error_302
return self.parent.open(new, timeout=req.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 515, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 532, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 1392, in https_open
return self.do_open(http.client.HTTPSConnection, req,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/urllib/request.py", line 1347, in do_open
raise URLError(err)
urllib.error.URLError:

```

Contributor guide

Open the contributing guide

Research direction

Start in install.py, especially install() around the request.urlretrieve call shown in the traceback, and review how download errors are currently handled. Define and test retry behavior for transient download failures, then verify that a failed first attempt can recover without changing successful downloads.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python
Domain
ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.