Skip to content

Commit

Permalink
[7.4.0] Downloader: Treat 502 as recoverable HTTP error. (#23388)
Browse files Browse the repository at this point in the history
GitHub releases sometimes fails with a 502 Bad Gateway error, as an
internal request times out.
We want to retry these requests, so treat the 502 errors as the other
500s.

Fixes #23334

Closes #23378.

PiperOrigin-RevId: 666244539
Change-Id: I2ed02ed9ecb3a7378c4d29b5ec5b96358e289779

Commit
5081ddb

Co-authored-by: Cornelius Riemenschneider <cornelius@github.com>
  • Loading branch information
bazel-io and criemen authored Aug 22, 2024
1 parent 048f843 commit 0815c06
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ URLConnection connect(
throw new IOException(describeHttpResponse(connection));
} else if (code < 500 // 4xx means client seems to have erred quoth RFC7231 § 6.5
|| code == 501 // Server doesn't support function quoth RFC7231 § 6.6.2
|| code == 502 // Host not configured on server cf. RFC7231 § 6.6.3
|| code == 505) { // Server refuses to support version quoth RFC7231 § 6.6.6
// This is a permanent error so we're not going to retry.
readAllBytesAndClose(connection.getErrorStream());
Expand All @@ -214,7 +213,7 @@ URLConnection connect(
}
throw new UnrecoverableHttpException(describeHttpResponse(connection));
} else {
// However we will retry on some 5xx errors, particularly 500 and 503.
// However we will retry on some 5xx errors, particularly 500, 502 and 503.
throw new IOException(describeHttpResponse(connection));
}
} catch (UnrecoverableHttpException | FileNotFoundException e) {
Expand Down

0 comments on commit 0815c06

Please sign in to comment.