Skip to content

[6.0] Add a maximum duration for sourcekitd requests #1547

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
merged 1 commit into from
Jul 2, 2024

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jul 2, 2024

  • Explanation: VS Code does not cancel semantic tokens requests. If a source file gets into a state where an AST build takes very long, this can cause us to wait for the semantic tokens from sourcekitd for a few minutes, effectively blocking all other semantic functionality in that file.
    To circumvent this problem (or any other problem where an editor might not be cancelling requests they are no longer interested in) add a maximum request duration for SourceKitD requests, defaulting to 2 minutes.
  • Scope: sourcekitd requests that take more than 2 minutes
  • Risk: Low, no reasonable sourcekitd request should take more than 2 minutes and users can override the timeout duration as a workaround
  • Testing: Added test case
  • Issue: rdar://130948453
  • Reviewer: @hamishknight on Add a maximum duration for sourcekitd requests #1543

VS Code does not cancel semantic tokens requests. If a source file gets into a state where an AST build takes very long, this can cause us to wait for the semantic tokens from sourcekitd for a few minutes, effectively blocking all other semantic functionality in that file.

To circumvent this problem (or any other problem where an editor might not be cancelling requests they are no longer interested in) add a maximum request duration for SourceKitD requests, defaulting to 2 minutes.

rdar://130948453
@ahoppen ahoppen requested a review from bnbarham July 2, 2024 21:07
@ahoppen
Copy link
Member Author

ahoppen commented Jul 2, 2024

@swift-ci Please test

@ahoppen ahoppen enabled auto-merge July 2, 2024 21:10
@ahoppen ahoppen merged commit 8c811b5 into swiftlang:release/6.0 Jul 2, 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