Skip to content

🍒[6.2][clang][cas] Handle CAS errors from OutputFile::keep() #10776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

benlangmuir
Copy link

  • Explanation: If a CAS error occurred when finishing an output file, it caused undefined behaviour due to the use of llvm::handleAllErrors without handling every possible error. In practice, this was causing us to silently drop the output file and cause mysterious downstream failures during module import or cache hit replay.
  • Scope: Affects builds that enable caching.
  • Risk: Low, this just adds another handler to the existing handleAllErrors that covers any remaining errors that fall through the other handlers.
  • Testing: Tested manually by creating a tmpfs volume for the CAS and causing it to run out of space. We don't have a good way to inject this kind of error for an automated test.
  • Issue: rdar://151077068
  • Reviewer: @cachemeifyoucan

When finishing output files we need to handle all possible Error kinds
or we will have undefined behaviour. In particular, if storing to the
CAS failed we could silently fail to add the main output leading to
mysterious downstream failures if we tried to replay that compilation,
or for modules when we tried to load the pcm contents.

rdar://151077068
(cherry picked from commit f2b5016)
@benlangmuir benlangmuir requested a review from a team as a code owner June 2, 2025 16:54
@benlangmuir
Copy link
Author

@swift-ci please test llvm

@benlangmuir
Copy link
Author

@swift-ci please test

@akyrtzi akyrtzi merged commit 49825a6 into swiftlang:swift/release/6.2 Jun 3, 2025
5 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.

2 participants