Skip to content

Commit ff25a2f

Browse files
authored
QNN SDK download: validate archive and retry on all errors (#19233)
### Summary The QNN backend test workflows have been flaking because the download from softwarecenter.qualcomm.com aborts mid-stream with `curl: (92) HTTP/2 stream 0 was not closed cleanly: INTERNAL_ERROR`, or returns a short error body that curl treats as a successful 200 — letting unzip choke on the not-a-zip with exit 9. The previous `curl --retry 3` only covered a narrow set of transient errors and never validated the archive, so neither failure was retried. Wrap the download in a five-attempt loop using `curl --fail --retry-all-errors` and validate each attempt with `unzip -t` before proceeding, with the on-disk file size logged on failure so a tiny error body is unambiguous in the log. Authored with Claude Code. ### Test plan CI
1 parent 9915faf commit ff25a2f

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

backends/qualcomm/scripts/install_qnn_sdk.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,27 @@ install_qnn() {
6464
mkdir -p "${QNN_INSTALLATION_DIR}"
6565

6666
QNN_ZIP_FILE="v${QNN_VERSION}.zip"
67-
curl --retry 3 -Lo "/tmp/${QNN_ZIP_FILE}" "${QNN_ZIP_URL}"
67+
# softwarecenter.qualcomm.com intermittently aborts the download with
68+
# HTTP/2 INTERNAL_ERROR mid-stream, and occasionally returns a tiny
69+
# error body that curl treats as success — both cases get caught here:
70+
# --fail rejects HTTP errors, --retry-all-errors retries transport
71+
# errors, and `unzip -t` validates the archive before we proceed.
72+
QNN_DOWNLOAD_MAX_ATTEMPTS=5
73+
for attempt in $(seq 1 ${QNN_DOWNLOAD_MAX_ATTEMPTS}); do
74+
rm -f "/tmp/${QNN_ZIP_FILE}"
75+
if curl --fail --retry 3 --retry-delay 5 --retry-connrefused --retry-all-errors \
76+
-Lo "/tmp/${QNN_ZIP_FILE}" "${QNN_ZIP_URL}" \
77+
&& unzip -tq "/tmp/${QNN_ZIP_FILE}"; then
78+
break
79+
fi
80+
ls -l "/tmp/${QNN_ZIP_FILE}" 2>&1 || true
81+
if [ "${attempt}" = "${QNN_DOWNLOAD_MAX_ATTEMPTS}" ]; then
82+
echo "ERROR: QNN SDK download failed after ${attempt} attempts" >&2
83+
exit 1
84+
fi
85+
echo "QNN SDK download attempt ${attempt} failed; retrying in $((attempt * 10))s..."
86+
sleep $((attempt * 10))
87+
done
6888
echo "Finishing downloading qnn sdk."
6989
unzip -qo "/tmp/${QNN_ZIP_FILE}" -d /tmp
7090
echo "Finishing unzip qnn sdk."

0 commit comments

Comments
 (0)