Skip to content

[6.2][clang][DependencyFile] Use atomic write for dependency file #10904

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

Open
wants to merge 1 commit into
base: swift/release/6.2
Choose a base branch
from

Conversation

cachemeifyoucan
Copy link

  • Explanation: Fix a race condition in the parallel build when dependency file is being updated by one compiler and being read by build system at same time. The fix is to make the write of .d file to be atomic.
  • Scope: Fix a race condition that can cause build failures occasionally.
  • Issues: rdar://154128578
  • Original PRs: [clang][DependencyFile] Use atomic write for dependency file #10902
  • Risk: Low. Change how the dependency file is written and no change in output content.
  • Testing: Unit Test
  • Reviewers: @benlangmuir

…ng#10902)

Previously when switch to output backend, dependency file was relying
on non-atomic write + discard to remove the out of date dependency file
when there are missing headers. The reliance on non-atomic write can
cause race conditions that build system is trying to read the file while the
file is being updated by a different compiler instance.

rdar://154128578
@cachemeifyoucan cachemeifyoucan requested a review from a team as a code owner June 26, 2025 20:04
@cachemeifyoucan
Copy link
Author

@swift-ci please test

@cachemeifyoucan cachemeifyoucan requested a review from akyrtzi June 26, 2025 20:05
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