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

[BUG] nio.fn.rpcrequest hangs indefinitely #25

Closed
olafurkarl opened this issue Jan 24, 2025 · 1 comment
Closed

[BUG] nio.fn.rpcrequest hangs indefinitely #25

olafurkarl opened this issue Jan 24, 2025 · 1 comment
Assignees

Comments

@olafurkarl
Copy link

olafurkarl commented Jan 24, 2025

NeoVim Version

NVIM v0.10.3
Build type: RelWithDebInfo
LuaJIT 2.1.1731601260

Describe the bug
When using neotest, my nvim process would completely freeze up.
I bisected the issue to the first and any following rpc requests made by the plugin via nvim-nio, e.g.:

local mode = nio.fn.rpcrequest(child_chan, "nvim_get_mode")

To Reproduce
Please provide a minimal init.lua to reproduce which can be run as the following:

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
	local lazyrepo = "https://github.com/folke/lazy.nvim.git"
	local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
	if vim.v.shell_error ~= 0 then
		vim.api.nvim_echo({
			{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
			{ out, "WarningMsg" },
			{ "\nPress any key to exit..." },
		}, true, {})
		vim.fn.getchar()
		os.exit(1)
	end
end
vim.opt.rtp:prepend(lazypath)

-- Setup lazy.nvim
require("lazy").setup({
	spec = {
		{
			{
				"nvim-neotest/neotest",
				dependencies = {
					"nvim-neotest/nvim-nio",
					"nvim-lua/plenary.nvim",
					"antoinemadec/FixCursorHold.nvim",
					"nvim-treesitter/nvim-treesitter",
					"marilari88/neotest-vitest",
				},
				config = function()
					local neotest = require("neotest")
					neotest.setup({
						log_level = vim.log.levels.info,
						adapters = {
							require("neotest-vitest"),
						},
					})
				end,
			},
		},
	},
})

Steps to reproduce the behavior:

  1. Open typescript test file
  2. Hover test
  3. Run lua require("neotest").run.run(). (either command line or using a keybind)
  4. NeoVim will completely hang while waiting for rpc response

Expected behavior
I expect it to run my test and give the appropriate updates to vim.

Logs
The preceding logs look like this:

INFO | 2025-01-24T21:17:38Z+0000 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:33 | Starting child process
INFO | 2025-01-24T21:17:38Z+0000 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:36 | Parent address: localhost:40351
INFO | 2025-01-24T21:17:38Z+0000 | ...l/share/nvim/lazy/neotest/lua/neotest/lib/subprocess.lua:42 | Starting child process with command: /usr/bin/nvim --embed --headless -n

There does not seem to be any exception that occurs, it simply waits indefinitely for a response.

Additional context
Not sure what could have caused this, but I had seen this working before on my machine.

I wasn't sure if this should be posted to nvim-neotest or nvim-nio, but I figured since I had traced the call to nvim-nio, I'd start here.

Any hints on how to solve it would be appreciated, I'm a big fan of this plugin and love running my tests through the editor! :)

@olafurkarl
Copy link
Author

I found that disabling flatten.nvim solves the issue, per nvim-neotest/neotest#468 (comment)

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

No branches or pull requests

2 participants