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

GH-39212: [Release] Retry download binary subprocess in case of OpenSSL error #39213

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions dev/release/download_rc_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,29 @@ def _download_url(self, url, dest_path, *, extra_args=None):
dest_path,
url,
]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()
if proc.returncode != 0:
try:
# Don't leave possibly partial file around
os.remove(dest_path)
except IOError:
pass
raise Exception(f"Downloading {url} failed\n"
f"stdout: {stdout}\nstderr: {stderr}")
# Retry subprocess in case it fails with OpenSSL Connection errors
# https://issues.apache.org/jira/browse/INFRA-25274
for attempt in range(5):
if attempt > 0:
delay = attempt * 3
print(f"Waiting {delay} seconds before retrying {url}")
time.sleep(delay)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()
if proc.returncode != 0:
try:
# Don't leave possibly partial file around
os.remove(dest_path)
except IOError:
pass
if "OpenSSL" not in stderr:
# We assume curl has already retried on other errors.
break
else:
return
raise Exception(f"Downloading {url} failed\n"
f"stdout: {stdout}\nstderr: {stderr}")

def _curl_version(self):
cmd = ["curl", "--version"]
Expand Down
Loading