Skip to content

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented Jun 30, 2025

Motivation

With the improvements to the position scanners (#3612 and #3583), we're now seeing some cases of invalid location being raised, despite no reports of any issues regarding the state of the documents.

I think we're making a mistake by trying to apply document operations with higher priority than feature requests. For example, if we receive a request for completion and the user immediately edits the file, the server might process the edit before finishing the completion request and there are no guarantees that the new state of the document can satisfy that original request.

I want to propose pushing text synchronization operations to the queue, so that they are processed in order and without locking, which I believe will improve the situation.

Implementation

I start pushing text synchronization operations to the work queue and removed many of the mutex locks that we originally had.

Since requests are processed in order, there should not be a chance of a feature request being processed with an incorrect document state.

@vinistock vinistock self-assigned this Jun 30, 2025
@vinistock vinistock added the server This pull request should be included in the server gem's release notes label Jun 30, 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 other Changes that aren't bugfixes, enhancements or breaking changes label Jun 30, 2025 — with Graphite App
@vinistock vinistock marked this pull request as ready for review June 30, 2025 14:28
@vinistock vinistock requested a review from a team as a code owner June 30, 2025 14:28
Copy link

graphite-app bot commented Jul 15, 2025

Merge activity

  • Jul 15, 7:03 PM UTC: vinistock added this pull request to the Graphite merge queue.
  • Jul 15, 7:07 PM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'cla').

### Motivation

With the improvements to the position scanners (#3612 and #3583), we're now seeing some cases of invalid location being raised, despite no reports of any issues regarding the state of the documents.

I think we're making a mistake by trying to apply document operations with higher priority than feature requests. For example, if we receive a request for completion and the user immediately edits the file, the server might process the edit before finishing the completion request and there are no guarantees that the new state of the document can satisfy that original request.

I want to propose pushing text synchronization operations to the queue, so that they are processed in order and without locking, which I believe will improve the situation.

### Implementation

I start pushing text synchronization operations to the work queue and removed many of the mutex locks that we originally had.

Since requests are processed in order, there should not be a chance of a feature request being processed with an incorrect document state.
@graphite-app graphite-app bot force-pushed the 06-20-remove_excessive_mutex_synchronization branch from 9d690ce to 99047b4 Compare July 15, 2025 19:05
@vinistock vinistock merged commit 2f50bd8 into main Jul 15, 2025
24 of 37 checks passed
@vinistock vinistock deleted the 06-20-remove_excessive_mutex_synchronization branch July 15, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
other Changes that aren't bugfixes, enhancements or breaking changes 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