karb94/neoscroll.nvim

Intermittent crashes while scrolling

gshpychka opened this issue ยท 21 comments

Sometime, usually upon first loading a file and scrolling (while LSP is loading, I think), neovim silently crashes near the end of the scroll. How do I debug this - where should I look for the logs?

I am on MacOS, using neoscroll with the default config.

I have the same issue, seems to happen most often when I am spamming Ctrl-D/U to scroll through my code. No red error messages or anything, just kicks me back to the terminal and I have to start up nvim again. I've disabled the plugin for now and will report if the crashes continue or stop happening.

EDIT: The performance fix seen here #80 (comment) still does not fix this crashing issue...

Have you always experienced this or did this issue appear after a Neovim or Neoscroll update?

Is there any way to reproduce it? Unfortunately, I have never experienced this myself.

Have you always experienced this or did this issue appear after a Neovim or Neoscroll update?

Is there any way to reproduce it? Unfortunately, I have never experienced this myself.

I can't say when it started appearing and unfortunately don't know a reliable way to reproduce this. I was hoping there would be logs somewhere that I could look at

What config are you using? If you see it happening with a particular config, e.g. when using easing functions, it might give us some clues.

What config are you using? If you see it happening with a particular config, e.g. when using easing functions, it might give us some clues.

To add a bit of info - I have the same exact behavior as @richardso21, i.e. usually happens when spamming Ctrl-D/U quickly, and especially while LSP is loading (not sure about this one).

Regarding my config, I'm pretty sure it's the default one:

require("neoscroll").setup({
	-- All these keys will be mapped to their corresponding default scrolling animation
	mappings = { "<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "<C-e>", "zt", "zz", "zb" },
	hide_cursor = true, -- Hide cursor while scrolling
	stop_eof = true, -- Stop at <EOF> when scrolling downwards
	respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
	cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
	easing_function = nil, -- Default easing function
	pre_hook = nil, -- Function to run before the scrolling animation starts
	post_hook = nil, -- Function to run after the scrolling animation ends
	performance_mode = false, -- Disable "Performance Mode" on all buffers.
})

Yes, spamming those keybinds while the LSP is loading usually spells trouble. This is my config with lazy.nvim (pretty barebones):

{
 	"karb94/neoscroll.nvim",
 	opts = {
 		easing_function = "sine",
	},
}

As for my lsp setup, I am using a combination of lsp-zero, mason, lspconfig, and nvim-cmp.

I am also having this issue - sometimes crashing with c-d/u. However, I experience it randomly, not just during LSP loading.

My config is simply:

         require("neoscroll").setup({
            easing_function = "sine",
         })

Update to this thread, I realize that this issue happens even when I am scrolling with my mouse wheel as well, even with this plugin removed. So if others experience this exact same thing as well, I think this is more of a neovim issue than it is neoscroll...

I can also add that I have seen this issue after replacing neoscroll with mini.animate, and so this issue is likely not just contained to neoscroll.

Can you pull the latest commit? It adds a pcall() to the scrolling function to handle any errors it may throw. This was done to fix another issue but could help here as well.

Haven't pulled the latest commit yet, but on ~/.local/state/nvim/log I see:

ERR 2024-02-09T10:26:18.125 ?.4867     chan_close_with_error:653: RPC: (null)

That's all, and it occurs every time I crash when scrolling (neoscroll or not). I'm not sure if anyone else is also seeing this as well. I'm also using MacOS Sonoma (14) with Kitty terminal for your information.

Yes, I am also seeing these messages in my log. And these occurred while using ctrl-{ / }.

ERR 2024-02-09T12:07:23.130 ?.44300    chan_close_with_error:653: RPC: (null)
ERR 2024-02-09T14:25:17.172 ?.87848    chan_close_with_error:653: RPC: (null)

I am going to switch back to neoscroll and see if the latest commit has fixed the issue.

@edwardbaeg I'm not sure how the ctrl-{ movement is tied to neoscroll as it is not animated by default. Did you map it to a scrolling animation?

@edwardbaeg I'm not sure how the ctrl-{ movement is tied to neoscroll as it is not animated by default. Did you map it to a scrolling animation?

I had recently switched over to try mini.animate to see if I could repro this issue and I was seeing the same problems. Sorry for the confusion, I forgot that neoscroll doesn't handle ctrl { }.

Since it's also happening with mini.animate, I suppose this is a neovim issue? However, if I run nvim --clean and I begin scrolling quickly I never run into this issue again... Maybe some other common plugin is the culprit

After a very long time of investigating which plugin would be causing this (so long in fact that I don't want to admit it), I pinpointed the cause to be messages (especially lsp progress messages) displayed by noice.nvim and nvim-notify. I found a way to reproduce this crash somewhat consistently, and that is to scroll very very fast on a large file while lsp is loading.

My fix for this is to set lsp = { progress = false } in noice.nvim's config. However, I will also say that I am using Neovim stable 0.9.5 despite noice.nvim strongly suggesting I use nightly (for some reason I can't get it to install with homebrew).

UPDATE: I can't reproduce this issue anymore using neovim nightly, but I encountered more inconvenient unrelated bugs along the way so I'll be staying on stable with this fix for now ๐Ÿ˜…

I don't have noice.nvim or nvim-notify installed and I am still getting booted from nvim while scrolling :/. This includes the latest commit for neoscroll. I'll see if I have any plugins similar to those that might be causing this.

@edwardbaeg could you please try to reproduce this without any plugins other than nvim-lspconfig? Also pull latest commit as it prevents endless loops (see #95) although this mostly applies to files with wrapped lines.

@karb94 I have not experienced any similar crashes for the last week. This may have resolved itself. Maybe this was due to some bad interaction with another plugin that was updated recently

This may have been caused at least in part by neovim/neovim#27859

I'll close this for now as it doesn't appear to be related to Neoscroll.