olimorris / persisted.nvim

💾 Simple session management for Neovim with git branching, autoloading and Telescope support
MIT License
418 stars 24 forks source link

[Bug]: uv_close: Assertion `!uv__is_closing(handle' failed #84

Closed linduxed closed 11 months ago

linduxed commented 11 months ago

Your Persisted.nvim config

I'm using the totally unchanged sample minimal.lua:

local root = "/tmp/persisted"

-- Set stdpaths to use root dir
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- Bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

vim.opt.sessionoptions = "buffers,curdir,folds,globals,tabpages,winpos,winsize" -- Session options to store in the session

-- Install plugins
local plugins = {
  {
    "olimorris/persisted.nvim",
    opts = {
      -- Your custom config here
    }
  },
  -- Put any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

Error messages

The following error message can not be seen with the minimal.lua configuration, but with my regular init.lua (which has plenty more plugins), I also experience a non-zero exit code, and the following error flashes very briefly (had to record my screen to read the text) in the top left of the screen before Neovim quits:

nvim: src/unix/core.c:147: uv_close: Assertion `!uv__is_closing(handle' failed.

Describe the bug

What I expect to happen

Neovim quits with a zero as exit code.

What actually happens

Neovim quits with a non-zero exit code.

Extra information

I did a git bisect to figure out when the issue was introduced, and it seems like the problem (at least for my setup) started in this commit: https://github.com/olimorris/persisted.nvim/commit/774e4d70e9f0092cc6d2850399fa1ccaca78fc5e

Reproduce the bug

  1. Start Neovim (nvim --clean -u minimal.lua)
  2. :q

Final checks

tmpm697 commented 11 months ago

I got the same issue. nvim: src/unix/core.c:147: uv_close: Assertion!uv__is_closing(handle' failed.` constantly block the UI, I was thougt this is smth due to nvim config somewhere.

olimorris commented 11 months ago

What version of Neovim are you using?

olimorris commented 11 months ago

...and how is this related to this plugin? The error message suggests a general issue with Neovim

tmpm697 commented 11 months ago

no idea but this issue only happens if i enable this plugin.

with both versions:

NVIM v0.10.0-dev-766+gef44e5972
neovim 0.9.1-3

more able to produce when you switch session with telescope.

@olimorris can u re-open this?

olimorris commented 11 months ago

Nothing has changed in this plugin in two weeks so seems odd that this issue is suddenly appearing. I suspect the issue stems from one of the other plugins installed in your config.

Happy to open this issue again if someone can provide a minimal.lua file which showcases the issue. I can't resolve an issue if it can't be recreated.

tmpm697 commented 11 months ago

it happens for long time, this issue happens when you close nvim, the line

nvim: src/unix/core.c:147: uv_close: Assertion `!uv__is_closing(handle' failed.

splash in screen before nvim exits that make it hard to capture it.

olimorris commented 11 months ago

The issue is a Neovim one, as reported here. A lot of people posting workarounds in that issue.

For future reference, the bug report template exists for many reasons:

  1. To ensure that the issue is infact an issue; a lot of the time it's a configuration issue for people
  2. To make sure I have a baseline to work from when trying to fix the issue
  3. To be protective of my time

Neovim is normally really good at spitting out error messages and the one you posted suggests it's a big scary internal bug so in the future always worth googling the error message or heading over to the Neovim GitHub repo in case someone else has encountered it and solved it.

linduxed commented 11 months ago

@olimorris I had no intention to waste your time. The reason for why I submitted the issue here were the following:

  1. My problems started after I started using this plugin in particular.
  2. As @tmpm697 mentioned, disabling this plugin results in the issue going away.
  3. The minimal config turned out to be sufficient to surface the problem for me.
  4. I managed to find a commit (through bisecting) that shows a point where this issue does not appear.

The Neovim issue that you link to seems to indeed be the actual issue, so I'll follow the development of that. No problem at all with this getting closed.

Thanks for your work!

olimorris commented 11 months ago

Hey @linduxed, my feedback was aimed at @tmpm697; this would be the third time they've submitted an issue without a proper minimal.lua file.

Hope you enjoy the plugin.

adrian5 commented 10 months ago

As per this comment, I've place this snippet alongside my persisted.nvim config until aforementioned Neovim issue is resolved:

vim.api.nvim_create_autocmd({ "VimLeave" }, {
  callback = function()
    vim.cmd("!notify-send ''")
    vim.cmd("sleep 10m")
  end,
})

That seems to do the job.


P.s. I've test driven multiple session plugins and this one hits the sweet spot for me in terms of features and flexibility vs ease-of-setup. Nice work Oli!