Skip to content

Retry metadata resolution on checksum mismatch during a publish - #19

Merged
artem-v merged 1 commit into
masterfrom
retry-checksum-mismatch
Oct 29, 2026
Merged

artem-v merged 1 commit into
masterfrom
retry-checksum-mismatch

Conversation

@artem-v

@artem-v artem-v commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Closes #18

Problem

A publish uploads maven-metadata.xml and maven-metadata.xml.sha1 separately. A resolution that falls between the two uploads gets one old and one new file, and MetadataResolver.resolveRemote fails right away with IOException: Checksum mismatch for maven-metadata, although a retry moments later would succeed. MavenResolver only retried FetchException 404, so the mismatch was never retried.

Change

  • MetadataResolver throws a dedicated ChecksumMismatchException (extends IOException, so existing catch sites still work).
  • MavenResolver retries it the same way as 404: the whole metadata-then-jar chain, re-fetching both metadata files on each attempt, with the same retryMaxAttempts / retryInitialDelayMs / retryMaxDelayMs. After the last attempt it fails with the mismatch as the cause. Other IOExceptions are still not retried.
  • A mismatched pair is never written to the local repository (unchanged behaviour, now covered by a test).
  • README retry section updated.

Out of scope: a jar checksum mismatch in JarResolver still fails immediately.

Tests

  • MetadataResolverTest: a mismatched metadata/sha1 pair fails with ChecksumMismatchException and leaves no files behind.
  • MavenResolverTest: mismatch then match resolves on the second attempt; a persistent mismatch fails after retryMaxAttempts with the mismatch as the cause; a plain IOException is not retried.

A publish uploads maven-metadata.xml and its .sha1 separately, so a resolution that lands between
the two uploads gets one old and one new file and fails at once with a checksum mismatch, although a
retry moments later succeeds. The 404 retry in MavenResolver did not cover it because the mismatch
was a plain IOException.

- MetadataResolver throws a dedicated ChecksumMismatchException (an IOException) for the mismatch.
- MavenResolver retries it like 404, re-fetching metadata and its .sha1 on each attempt with the
  same retryMaxAttempts and back-off; it fails with the mismatch as the cause once attempts run out.
  Other IOExceptions are still not retried.
- A mismatched pair is never published to the local repository; a test now pins that.
- README retry section documents the new retry case.

Closes #18
@artem-v
artem-v merged commit 3514f36 into master Oct 29, 2026
3 checks passed
@artem-v
artem-v deleted the retry-checksum-mismatch branch October 29, 2026 13:39
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.

Retry metadata resolution on checksum mismatch during a publish

1 participant