leap.nvim icon indicating copy to clipboard operation
leap.nvim copied to clipboard

Random crashes occuring

Open DanielVolchek opened this issue 10 months ago • 15 comments

Not sure how to debug this as no errors pop up

https://github.com/ggandor/leap.nvim/assets/25828026/cd52d76d-3ecf-4fea-a67c-5c5374df6294

This is my config

return {
  "ggandor/leap.nvim",
  keys = {
    {
      "s",
      function()
        vim.cmd("normal m'")

        local leap = require("leap")
        leap.leap({ target_windows = { vim.fn.win_getid() } })
      end,
    },
  },
  config = function()
    local leap = require("leap")
    leap.opts.safe_labels = {}
  end,
}

Please let me know if you need any additional information to help get this resolved

DanielVolchek avatar Mar 27 '24 14:03 DanielVolchek

Hi!

  1. Since when? Or is this your first time using the plugin?
  2. How frequently does this problem occur? Always? Sometimes? Any pattern?

Config sidenotes:

  • Leap sets m', no need to do that manually
  • Don't use keys (https://github.com/ggandor/leap.nvim?tab=readme-ov-file#installation)

ggandor avatar Mar 28 '24 09:03 ggandor

Since when

I've been using it for a while but only just upgraded from packer to lazy and at the same time updated the plugin. Not sure what old version I was using but it wasn't occurring before I made the change

How frequently

It seems to happen randomly. Sometimes it will be the very first time I use it, other times it will happen after 4-5 leaps. No pattern I've been able to figure out so far. I've only seen it occur in bigger files, so maybe that.

I tried changing the config to this

return {
	"ggandor/leap.nvim",
	lazy = false,

	config = function()
		local leap = require("leap")
		leap.opts.safe_labels = {}

		vim.keymap.set("n", "s", "<Plug>(leap)")
		vim.keymap.set("n", "S", "<Plug>(leap-from-window)")
		vim.keymap.set({ "x", "o" }, "s", "<Plug>(leap-forward)")
		vim.keymap.set({ "x", "o" }, "S", "<Plug>(leap-backward)")
	end,
}

but it is still happening

DanielVolchek avatar Mar 28 '24 13:03 DanielVolchek

+1 I can confirm that I'm experiencing the same issue even in small files. My config is fairly minimal

-- lazy installation
require('lazy').setup({
...
  "ggandor/leap.nvim",
...
}
-- keybinds (declared in a separate file)
vim.keymap.set({'n', 'x', 'o'}, '<leader>s', '<Plug>(leap)')
vim.keymap.set({'n', 'x', 'o'}, '<leader>S', function ()
  local focusable_windows = vim.tbl_filter(
    function (win) return vim.api.nvim_win_get_config(win).focusable end,
    vim.api.nvim_tabpage_list_wins(0)
  )
  require('leap').leap { target_windows = focusable_windows }
end)

ufUNnxagpM avatar Mar 29 '24 04:03 ufUNnxagpM

Not sure what old version I was using but it wasn't occurring before I made the change

Well, this is good news, but then it's up to you guys to bisect and find the guilty commit (since I cannot reproduce).

ggandor avatar Mar 29 '24 10:03 ggandor

I restarted my computer and it seems to have fixed it. I'd guess some ghost files in the cache conflicting with Lazy or something like that. I'll keep this open if @ufUNnxagpM continues experiencing it but for me it is resolved.

DanielVolchek avatar Mar 29 '24 13:03 DanielVolchek

Hi, i'm also getting crashes after commit cc0be53d66e31c76101e2224734830ab8490653d, no issue with b8728bd2204c15e9f9956b90921ac8bba3b6e7a3

https://github.com/ggandor/leap.nvim/assets/237278/c59f0489-5784-4c29-8e69-e45536fc29a6

in the video above, i pressed "s e", and it crashes with that error

return {
	{
		"ggandor/flit.nvim",
		keys = function()
			local ret = {}
			for _, key in ipairs({ "f", "F", "t", "T" }) do
				ret[#ret + 1] = { key, mode = { "n", "x", "o" }, desc = key }
			end
			return ret
		end,
		opts = { labeled_modes = "nx" },
	},
	{
		"ggandor/leap.nvim",
		keys = {
			{ "s", mode = { "n", "x", "o" }, desc = "Leap forward to" },
			{ "gs", mode = { "n", "x", "o" }, desc = "Leap from windows" },
		},
		commit = "b8728bd",
		config = function(_, opts)
			require("leap").add_default_mappings(true)
			vim.keymap.set("n", "s", function()
				local current_window = vim.fn.win_getid()
				require("leap").leap({ target_windows = { current_window } })
			end)
			vim.keymap.set({ "o", "x" }, "S", "<Plug>(leap-backward-till)")
			vim.keymap.set({ "o", "x" }, "s", "<Plug>(leap-forward-till)")
		end,
	},
}

edward-s avatar Mar 29 '24 17:03 edward-s

i'm also getting crashes after commit cc0be53, no issue with b8728bd

I can also confirm this. Switching to commit cc0be53 will get crashes, and there will be no issue with b8728bd.

Also, I didn't seem to get the crashes on the Windows platform. Only on macos. I'm using iTerm.

kkpattern avatar Mar 31 '24 10:03 kkpattern

I am in the dark here, cc0be53 seems a totally safe refactoring to me. Since I cannot reproduce, I cannot experiment either, so please try to find out where the actual problem is, if you can follow the logic, it's a pretty small diff. (Just tweak the compiled lua code if you don't have fennel at hand.)

What are the values of in1 and ?in2 right before this line? (just insert print(in1, _3fin2); vim.cmd.sleep('2000m')) (lua) https://github.com/ggandor/leap.nvim/commit/cc0be53d66e31c76101e2224734830ab8490653d#diff-35d5e086704b9dbc34e22f4f5976a5bb775bb74ae624473176eabcadf406adb5R680 (fennel) https://github.com/ggandor/leap.nvim/commit/cc0be53d66e31c76101e2224734830ab8490653d#diff-1efecb4315c2ab92d505fd3f6d75ca27abc987cd4b6f95afcc7ad3e83462002eR642

ggandor avatar Mar 31 '24 14:03 ggandor

I tried to help out by adding the print line at ~/.local/share/nvim/lazy/leap.nvim/lua/leap/main.lua but have no idea where or what to do next (lua noob)

anyways, i upgraded to the latest commit and am still able to consistently crash neovim with Error: Process exited with error code 139 by just doing s e, back to b8728bd for now

edward-s avatar Apr 01 '24 03:04 edward-s

This is further proof that cc0be53 is the crash culprit for me

https://github.com/ggandor/leap.nvim/assets/237278/1e862162-3bb6-4f18-a0fd-fcca03503b90

edward-s avatar Apr 01 '24 03:04 edward-s

I tried to help out by adding the print line at ~/.local/share/nvim/lazy/leap.nvim/lua/leap/main.lua but have no idea where or what to do next (lua noob)

It crashes before printing then?

ggandor avatar Apr 01 '24 10:04 ggandor

no longer crashing for me after updating to the latest release, thanks!

edward-s avatar Apr 10 '24 00:04 edward-s

I have no idea what fixed the problem in the meanwhile (if it is indeed fixed), so could you guys please search for the commit again? This is probably the most mysterious bug I've encountered here so far.

ggandor avatar Apr 10 '24 09:04 ggandor

Seems 1f38806fdc0d6e4fbe26d1c595fc8566823d8c64 fixed the crash for me.

kkpattern avatar Apr 10 '24 09:04 kkpattern

I can also confirm that https://github.com/ggandor/leap.nvim/commit/1f38806fdc0d6e4fbe26d1c595fc8566823d8c64 fixed the crash for me. the commit before that (https://github.com/ggandor/leap.nvim/commit/7a9407d17fab3a1c3cfe201965d680a408776152) consistently crashes for me

edward-s avatar Apr 11 '24 12:04 edward-s