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

fix: opening summary window freezes when subprocess finds swap file #311

Merged
merged 1 commit into from
Dec 21, 2023

Conversation

luismeyer95
Copy link
Contributor

@luismeyer95 luismeyer95 commented Nov 11, 2023

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()
  • freeze happens

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 running nvim without providing a file/dir argument. At some point after toggling the summary window, the nvim subprocess is spawned with nvim --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.

@rcarriga
Copy link
Collaborator

Nice thank you! 😄

@rcarriga rcarriga merged commit 7610198 into nvim-neotest:master Dec 21, 2023
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