Skip to content

Add timeouts and retries to the vanilla jar download - #76

Open
u9g wants to merge 1 commit into
PaperMC:mainfrom
u9g:download-timeouts
Open

u9g wants to merge 1 commit into
PaperMC:mainfrom
u9g:download-timeouts

Conversation

@u9g

@u9g u9g commented Sep 25, 2026

Copy link
Copy Markdown

DownloadContext.download fetches the vanilla jar with URL.openStream(), which has no connect or read timeout. If the CDN accepts the connection and then stalls, Paperclip waits forever: there is no exception to catch and nothing is logged after Downloading …. We hit this in CI, where a first start with an empty bundlerRepoDir hung until the job's own timeout killed it, and the only fix was to wrap Paperclip in a timeout from outside.

This opens the URL through URLConnection with a 30s connect and read timeout, and retries the download up to three times before giving up the way it does today (print the exception, exit 1).

A dropped connection mid-body is a related case: HttpURLConnection returns end-of-stream rather than throwing, so the short file only shows up at the hash check, which threw with no retry. The hash check now sits inside the same loop, so a truncated download is retried too and only the third failure throws.

Tested by hand with a small DownloadContext driver against a local HTTP server:

  • headers sent, body never sent: three Read timed out after 30s each, then exit 1
  • unroutable address: three connect timeouts, then exit 1
  • body cut short twice, then served in full: two Hash check failed … (attempt n of 3) lines, then success
  • normal download: unchanged

./gradlew build passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant