damccorm commented on code in PR #41065:
URL: https://github.com/apache/beam/pull/41065#discussion_r4512695371


##########
.github/actions/gradle-command-self-hosted-action/action.yml:
##########
@@ -41,6 +41,11 @@ runs:
         if [ -f ~/.m2/settings.xml ]; then
           rm ~/.m2/settings.xml
         fi
+        if ! ls 
"${GRADLE_USER_HOME:-$HOME/.gradle}"/wrapper/dists/gradle-*/*/*.ok >/dev/null 
2>&1; then
+          for attempt in 1 2 3; do

Review Comment:
   Increasing `networkTimeout=60000` in `gradle-wrapper.properties` only raises 
the socket connect/read timeout for a **single** HTTP request inside 
`GradleWrapperMain` (`DefaultDownloader`), which has no built-in retry logic.
   
   When `services.gradle.org/distributions/gradle-8.14.3-bin.zip` redirects 
(`HTTP 307`) to `github.com/gradle/gradle-distributions/releases/download/...`, 
GitHub Releases intermittently returns an immediate `HTTP 504 Gateway Timeout` 
/ `HTTP 502` or connection reset on the initial request (e.g. runs 
[42568239985](https://github.com/apache/beam/actions/runs/42568239985), 
[42571168943](https://github.com/apache/beam/actions/runs/42571168943), 
[42571799437](https://github.com/apache/beam/actions/runs/42571799437), and 
[42581523848](https://github.com/apache/beam/actions/runs/42581523848)). In 
those cases, a higher `networkTimeout` alone still fails immediately on the 
first 504 response.
   
   Guarding the 3-attempt `./gradlew --version --no-daemon` loop behind `if ! 
ls "${GRADLE_USER_HOME:-$HOME/.gradle}"/wrapper/dists/gradle-*/*/*.ok` ensures 
it only runs on a wrapper cache miss (when the distribution zip hasn't been 
downloaded/unpacked yet) and retries transient 502/504s before running the 
actual Gradle task, while adding zero overhead when the wrapper is already 
cached.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to