Skip to content
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

Add custom request to return LSP internal state #3194

Merged

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Feb 13, 2025

Motivation

Diagnosing concurrency issues in the LSP tends to be very difficult and without more detailed information about the state of the language server, it becomes extra challenging to understand what's going on.

Let's add a command to surface internal state information, which we can hook to a command in the extension. When users manage to reproduce the problem, they can invoke the command and provide richer details.

Implementation

The idea is to return internal state information that may be relevant to diagnose a corrupt state or crash. For now, I included the state of the worker, backtrace, size of the incoming queue and all stored documents.

This should hopefully help us understand the following things:

  1. Is the worker dead or just stuck?
  2. If it's stuck, where is it stuck? Is the queue increasing causing the worker to get backlogged?
  3. Why did we get stuck? Are the documents we stored in an out of sync state with the client?

Automated Tests

Added a test.

@vinistock vinistock added the server This pull request should be included in the server gem's release notes label Feb 13, 2025 — with Graphite App
Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock added the enhancement New feature or request label Feb 13, 2025 — with Graphite App
@vinistock vinistock self-assigned this Feb 13, 2025
@vinistock vinistock requested review from andyw8 and st0012 February 13, 2025 15:22
@vinistock vinistock marked this pull request as ready for review February 13, 2025 15:26
@vinistock vinistock requested a review from a team as a code owner February 13, 2025 15:26
@vinistock vinistock force-pushed the 02-13-add_custom_command_to_return_lsp_internal_state branch from 139c44a to 2afdeb7 Compare February 13, 2025 15:29
@vinistock vinistock added the graphite-merge Ship this PR using Graphite's merge queue label Feb 13, 2025
Copy link
Member Author

vinistock commented Feb 13, 2025

Merge activity

  • Feb 13, 10:45 AM EST: The merge label 'graphite-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Feb 13, 12:55 PM EST: A user added this pull request to the Graphite merge queue.
  • Feb 13, 1:23 PM EST: A user merged this pull request with the Graphite merge queue.

@vinistock vinistock force-pushed the 02-13-add_custom_command_to_return_lsp_internal_state branch from 2afdeb7 to cf32d6a Compare February 13, 2025 15:46
@vinistock vinistock changed the title Add custom command to return LSP internal state Add custom request to return LSP internal state Feb 13, 2025
@vinistock vinistock force-pushed the 02-13-add_custom_command_to_return_lsp_internal_state branch from cf32d6a to 2fd31fd Compare February 13, 2025 15:56
### Motivation

Diagnosing concurrency issues in the LSP tends to be very difficult and without more detailed information about the state of the language server, it becomes extra challenging to understand what's going on.

Let's add a command to surface internal state information, which we can hook to a command in the extension. When users manage to reproduce the problem, they can invoke the command and provide richer details.

### Implementation

The idea is to return internal state information that may be relevant to diagnose a corrupt state or crash. For now, I included the state of the worker, backtrace, size of the incoming queue and all stored documents.

This should hopefully help us understand the following things:

1. Is the worker dead or just stuck?
2. If it's stuck, where is it stuck? Is the queue increasing causing the worker to get backlogged?
3. Why did we get stuck? Are the documents we stored in an out of sync state with the client?

### Automated Tests

Added a test.
@graphite-app graphite-app bot force-pushed the 02-13-add_custom_command_to_return_lsp_internal_state branch from 2fd31fd to 632113a Compare February 13, 2025 17:56
@graphite-app graphite-app bot merged commit 632113a into main Feb 13, 2025
42 checks passed
@graphite-app graphite-app bot deleted the 02-13-add_custom_command_to_return_lsp_internal_state branch February 13, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request graphite-merge Ship this PR using Graphite's merge queue server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants