Skip to content

Fix a race condition that could cause the build graph to not be generated when doing initial background indexing #1652

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

Merged

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Sep 9, 2024

We were making the initial generateBuildGraph call in SourceKitLSPServer from a Task. This means that generateBuildGraph could be executed after waitForUpToDateBuildGraph was called by SemanticIndexManager. Thus waitForUpToDateBuildGraph returned immediately and no files were background indexed.

Make generateBuildGraph immediately schedule a package reload for SwiftPM build systems instead of doing the hop through a Task, fixing the race condition.

rdar://135551812

…ated when doing initial background indexing

We were making the initial `generateBuildGraph` call in `SourceKitLSPServer` from a `Task`. This means that `generateBuildGraph` could be executed after `waitForUpToDateBuildGraph` was called by `SemanticIndexManager`. Thus `waitForUpToDateBuildGraph` returned immediately and no files were background indexed.

Make `generateBuildGraph` immediately schedule a package reload for SwiftPM build systems instead of doing the hop through a `Task`, fixing the race condition.

rdar://135551812
@ahoppen
Copy link
Member Author

ahoppen commented Sep 9, 2024

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge September 9, 2024 19:01
@ahoppen ahoppen merged commit 765c2c0 into swiftlang:main Sep 9, 2024
3 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