Repository navigation
fix(editor): prevent file-watch freezes and bound LSP exit waits - #419
Merged
Merged
Conversation
Register open-buffer and LSP workspace watches on dedicated workers while retaining polling fallbacks. Coalesce pending open-buffer changes and keep native teardown off the editor thread. Add correlated trace spans and blocked-registration regression tests. Bound the non-Windows language-server exit grace period to 500ms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening the file tree or file picker in a large project could freeze the editor for seconds while macOS registered native file watches. Session restoration could hit the same blocking API when starting an LSP workspace watcher. Exiting could then wait another five seconds for a language server that had already acknowledged shutdown.
Move open-buffer and LSP workspace watcher registration onto dedicated threads. Open-buffer updates coalesce to the latest requested set, native teardown stays off the editor thread, and existing polling fallbacks continue to detect changes while registration is pending or unavailable. Limit the post-
exitprocess grace period to 500 ms on non-Windows platforms; preserve Windows' 100 ms grace and the separate shutdown-response timeout.Opt-in performance tracing now includes correlated span IDs, monotonic timestamps, thread IDs, and input/background/watcher/LSP-start timings. It remains disabled by default (
RED_PERF=traceenables detailed tracing).How to Test
cargo build --bin red. Launch that binary from a large repository with several restored buffers, including a file that starts an LSP server. Press Ctrl+E and Ctrl+P: both should open promptly while native watches register in the background. WithRED_PERF=trace, watcher-registration spans should run on worker threads rather than the editor thread.shutdownbut remains alive afterexit: Red should terminate and reap it after the 500 ms grace period on macOS/Linux, rather than waiting five seconds.cargo test --lib editor::file_watch,cargo test --lib lsp::workspace_watch, andcargo test --lib shutdown. The blocked-registration tests cover responsive input, polling, teardown, and coalescing; the shutdown tests cover protocol ordering and concurrent client shutdown.Validation
zip 9.0.4. Repository manifests and lockfile are unchanged; exact-lock Clippy remains blocked locally and needs CI validation. Linux and Windows behavior was not manually tested.