fix: opening summary window freezes when subprocess finds swap file #311
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.
Hi! 👋
I've been having a bug for a while which happened seemingly randomly: sometimes when toggling the test summary window, Neovim would freeze completely, forcing a kill + restart of the process.
Steps were the following:
nvim
:lua require('neotest').summary.toggle()
I found the hanging line with some trial and error,
subprocess.lua:41
which tries to load neotest in the nvim subprocess and blocks until it gets a response. The fix I found is to spawn the nvim subprocess with swap files disabled.I have the
Shatur/neovim-session-manager
plugin installed, and it is configured (by default) to open the last opened session when runningnvim
without providing a file/dir argument. At some point after toggling the summary window, the nvim subprocess is spawned withnvim --embed --headless
re-using the user's config. What I suspect is happening: this subprocess will open the last opened session and open the same files as the main instance, which causes it to error on swap file conflicts and somehow prevent the RPC call to complete.-n
nvim CLI flag tells the subprocess to ignore swap files, and after including it + manual testing I've seen no freeze yet with the above scenario.I tried to reproduce the freeze in other ways, by editing my nvim config to throw errors on startup only for the subprocess, but no freeze with those scenarios.