Skip to content

Retry priors file write with exponential backoff#2121

Merged
cachemeifyoucan merged 1 commit into
swiftlang:mainfrom
cachemeifyoucan:eng/PR-priors-file-backoff
Apr 15, 2026
Merged

Retry priors file write with exponential backoff#2121
cachemeifyoucan merged 1 commit into
swiftlang:mainfrom
cachemeifyoucan:eng/PR-priors-file-backoff

Conversation

@cachemeifyoucan

Copy link
Copy Markdown
Contributor

On Windows, atomic file writes (temp file + rename) can fail intermittently with ERROR_ACCESS_DENIED if updates to the file happens really close to the write of the file underload.

This can especially happen to .priors file in a tight rebuild loop. Now writes .priors file in a retry loop with exponential back off.

Assisted-By: Claude

  • Explanation: Fix a corner case that can cause driver failures during incremental build.
  • Scope: Mostly invisible to user.
  • Risk: Low. Mostly NFC other than the retry added.

@cachemeifyoucan
cachemeifyoucan requested a review from a team as a code owner April 14, 2026 20:46
@cachemeifyoucan
cachemeifyoucan force-pushed the eng/PR-priors-file-backoff branch from c28c52a to 5084a98 Compare April 14, 2026 20:48
@cachemeifyoucan

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@cachemeifyoucan
cachemeifyoucan force-pushed the eng/PR-priors-file-backoff branch from 5084a98 to d4cc893 Compare April 14, 2026 22:07
@cachemeifyoucan

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

Comment thread Sources/SwiftDriver/Utilities/ExponentialBackoff.swift
@cachemeifyoucan
cachemeifyoucan force-pushed the eng/PR-priors-file-backoff branch from d4cc893 to 2168a4c Compare April 14, 2026 22:36
@cachemeifyoucan

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

Comment thread Sources/SwiftDriver/Utilities/ExponentialBackoff.swift Outdated
On Windows, atomic file writes (temp file + rename) can fail
intermittently with ERROR_ACCESS_DENIED if updates to the file happens
really close to the write of the file underload.

This can especially happen to `.priors` file in a tight rebuild loop.
Now writes `.priors` file in a retry loop with exponential back off.

Assisted-By: Claude
@cachemeifyoucan
cachemeifyoucan force-pushed the eng/PR-priors-file-backoff branch from 2168a4c to 8c7d946 Compare April 14, 2026 22:45
@cachemeifyoucan

Copy link
Copy Markdown
Contributor Author

@swift-ci please test

@cachemeifyoucan

Copy link
Copy Markdown
Contributor Author

@swift-ci please test windows platform

@cachemeifyoucan
cachemeifyoucan merged commit 3323247 into swiftlang:main Apr 15, 2026
25 checks passed
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.

4 participants