Repository navigation
Error: Java setup failed due to network issue or timeout: read ECONNRESET #923
Description
Activity
+1
Meet the same issue.Hi @snago,
Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.Hi snago,
Thank you for reporting this issue. The ECONNRESET error during Java distribution downloads is indeed frustrating, especially when it compounds across multiple jobs in a workflow. I understand the impact this has on your CI/CD reliability.
Immediate Workaround – Manual Retry
While we work on a permanent solution, you can implement a manual retry mechanism in your workflows to significantly reduce the failure rate.Reduce Network Calls with Tool Cache
To further minimize download failures, you can cache the Java installation itself. This avoids repeated downloads from external sources and makes your workflows more resilient to network issues:- name: Cache Java Installation uses: actions/cache@v4 with: path: | ${{ runner.tool_cache }}/Java_Corretto_jdk/25* ~/hostedtoolcache/Java_Corretto_jdk/25* key: ${{ runner.os }}-java-corretto-25-${{ hashFiles('.github/workflows/*.yml') }} restore-keys: | ${{ runner.os }}-java-corretto-25- - name: Setup Java uses: actions/setup-java@v5 with: distribution: 'corretto' java-version: '25'Constraints to note:
- Initial download needed: The first run always downloads Java; caching speeds up only subsequent runs.
- Runner and OS differences: Cache paths may differ between runner types and operating systems.
- Workflow changes invalidate cache: Updates to workflow files (e.g., .github/workflows/*.yml) will trigger creation of a new cache.
Hi @snago, Just wanted to follow up and see if the feedback provided has helped resolve your issue. Let me know if you need any further assistance!
The "internet weather" has been pretty calm lately. I haven't seen the problem in a while.
Thanks for the workarounds! Next time it happens I'll try the tool cache approach.
It adds a lot of clutter to the workflow though, so some retries insetup-javaitself would still be an improvement, IMHO.Hi @snago,
Thank you for your patience and feedback on this issue.
I completely understand your concern about the tool cache approach adding unnecessary complexity to workflows. You're absolutely right that having built-in retry logic in setup-java would provide a much cleaner and more maintainable solution.
The good news is that we're actively working on implementing a retry mechanism to handle transient network failures like the ECONNRESET errors you experienced. This enhancement will automatically retry failed downloads when temporary connectivity issues occur, eliminating the need for manual workarounds in your workflows.
Since the immediate issue appears to have been resolved (likely due to improved network conditions between GitHub Actions and the download endpoints), I'll close this issue for now. However, please don't hesitate to reopen this issue if you encounter similar ECONNRESET errors again or create a new issue with any additional details or patterns you observe.
@mahabaleshwars JFYI: we see this connection issue still occurring a lot. Multiple times a day, taking up to 10 retries.
Description:
Sometimes setup-java fails with
Error: Java setup failed due to network issue or timeout: read ECONNRESETWe use
distribution: 'corretto'andjava-version: '25', but it also happened on earlier Java versions.The error is rare and seems to vary from day to day, probably ~.1-5%, but for a workflow with 20+ jobs even a 1% error probability means the probability that any of the jobs fail is over 18%.
It would be nice if there was some built-in retries.
Task version:
actions/setup-java@v5Also happened on
actions/setup-java@v4.Platform:
Runner type:
Repro steps:
Run setup-java many times (?).
Expected behavior:
No errors.
Actual behavior:
Sometimes fails with
ECONNRESET.