Skip to content

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Sep 29, 2025

Cherry-pick of #1989

  • Explanation: Using the content hash in the response file name caused us to require using the atomic FS write API, due to a possibility that concurrently-running driver processes may encounter a need to build a common, shared module dependency with an identical command-line recipe. In such a scenario there was a possibility of a race in writing out the response file for this command.
    We have since seen challenges with the current atomic FS write APIs and this PR is an alternative approach to tackling this problem. Instead of using the content hash, we will use UUID to ensure that we do not have races when multiple drivers are creating a response file for an identical command. In addition, we add an API for build system clients so that they can directly examine the pre-response-file-creation command line arguments directly from the ArgsResolver, without needing to read the response file from the filesystem.

  • Scope: Affects builds which contain compilation tasks with command lines which do not fit the system default command line size, triggering response file use.

  • Risk: Low. The risk is low to build functionality since we expect this to largely not matter to being able to successfully build a given project. There is some risk to build performance if we do not correctly take this change into account in the build system, but we have an accompanying change in SwiftBuild to ensure that does not happen.

  • Reviewed By: @owenv

  • Problem: rdar://159417339

  • Original PR: Use UUID for response file names and add 'resolveArgumentList' API which contains original command-line if a response file is used #1989

We've been having issues with content hash causing collisions as well as issues with underlying Foundation atomic APIs. For now, attempt to simply make the files unique with a uuid.
@artemcm
Copy link
Contributor Author

artemcm commented Sep 29, 2025

@swift-ci test

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

Successfully merging this pull request may close these issues.

2 participants