- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 632
Open
Labels
Description
Description
After upgrading to 0.10.*, closing nvim causes a long pause, up to 10 seconds.
This seems to be similar to #2438, but it is replicable with zero changes made to the cleanroom config, and is not related to node_modules
or any similar large directory.
This is replicable using the absolute barebones cleanroom config without any changes made.
There appears to be no relevant info in nvim-tree.log as all logged lines occurs before the attempted close.
This behaviour has two interesting cases
- If any subdirectories of the open path contains a
.git
directory, the bug occurs, it does not only apply to the root open path - The issue also persists if a
.git
directory simply exists without being an actual git repo
Neovim version
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1727870382
git version 2.47.0
Operating system and version
MacOS 14.1
Windows variant
No response
nvim-tree version
Clean room replication
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvt-min/site]])
local package_root = "/tmp/nvt-min/site/pack"
local install_path = package_root .. "/packer/start/packer.nvim"
local function load_plugins()
require("packer").startup({
{
"wbthomason/packer.nvim",
"nvim-tree/nvim-tree.lua",
"nvim-tree/nvim-web-devicons",
-- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
},
config = {
package_root = package_root,
compile_path = install_path .. "/plugin/packer_compiled.lua",
display = { non_interactive = true },
},
})
end
if vim.fn.isdirectory(install_path) == 0 then
print("Installing nvim-tree and dependencies.")
vim.fn.system({ "git", "clone", "--depth=1", "https://github.com/wbthomason/packer.nvim", install_path })
end
load_plugins()
require("packer").sync()
vim.cmd([[autocmd User PackerComplete ++once echo "Ready!" | lua setup()]])
vim.opt.termguicolors = true
vim.opt.cursorline = true
-- MODIFY NVIM-TREE SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
_G.setup = function()
require("nvim-tree").setup({
log = {
enable = true,
truncate = true,
types = {
all = false,
config = false,
copy_paste = false,
dev = false,
diagnostics = true,
git = true,
profile = true,
watcher = true,
},
},
})
end
-- UNCOMMENT this block for diagnostics issues, substituting pattern and cmd as appropriate.
-- Requires diagnostics.enable = true in setup.
--[[
vim.api.nvim_create_autocmd("FileType", {
pattern = "lua",
callback = function()
vim.lsp.start {
name = "my-luals",
cmd = { "lua-language-server" },
root_dir = vim.loop.cwd(),
}
end,
})
]]
Steps to reproduce
- Create a new directory to test in
- Initialize a git repo in the directory, or create an empty .git directory within
- Open directory with cleanroom configuration
- Toggle the visibility of the tree
- Close the project
Expected behavior
Standard close behavior.
Actual behavior
A hang/delay of up to 10 seconds before nvim closes.
michaelvanstraten
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
[-]Application slow closing directories git repos[/-][+]Application slow closing directories with .git contained[/+]djames-bloom commentedon Nov 9, 2024
As mentioned, this issue happens when a sub-directory contains
.git
pathse.g. the following structure triggers the issue
alex-courtis commentedon Nov 9, 2024
Sorry, not able to replicate this one on linux. Attempt:
Collected a log, normalised and compared to yours:
That
+Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
might be interesting, or may just be a difference between git implementations. Have you got anything interesting or unusual in your~/.gitconfig
?I'd be grateful if you can perform some further tests:
/tmp
filesystem_watchers.enable = false
git.enable = false
alex-courtis commentedon Nov 9, 2024
Rolling back to minor versions:
cd /path/to/nvim-tree.lua git pull git checkout v1.7.0
When you're finished testing:
djames-bloom commentedon Nov 11, 2024
Hey Alex, thanks for looking into this
RE gitconfig, it doesn't look like theres anything in there that would be causing this kind of effect, but in case, you can find a copy here.
I'll update this comment once I've had a chance to run the additional tests.
Edit: testing the above results in the following, in a path in my home directory, using the cleanroom config
filesystem_watchers.enable = false
- Appears to resolve - loggit.enable = false
- No change - logDisabling the above changes and testing with previous versions
v1.7.0
- slowv1.6.0
- slowv1.5.0
- slowv1.4.0
- slowalex-courtis commentedon Nov 16, 2024
git toplevel takes 25ms, for me (linux) it's 5ms, however that's not a great issue. You might want to try git fsmonitor daemon
Matches my times.
It seem that the issue is the filesystem watchers, specifically closing them. Are you running any virus scanners or similar file system monitoring daemons?
alex-courtis commentedon Nov 16, 2024
This might be a vim problem. Please try this:
Creation should be near-instant.
Time exiting, also should be instant.
/tmp/foo.lua:
michaelvanstraten commentedon Nov 26, 2024
I can confirm this issue on the following setup:
nvim -V1 -v
for more details)To reproduce the issue, I needed to open a few directories and a file.
Here is a performance profile captured while browsing the
mozilla-central
repository.alex-courtis commentedon Nov 30, 2024
Thanks for the additional info; I'm not quite sure what to do with it or how to read the profile output.
Did you perform this test? #2997 (comment)
We need to isolate whether this is an nvim-tree issue or a neovim issue, by attempting to replicate without nvim-tree.
What exactly needs to be done? How would I replicate this?
I'll need full instructions on the profiler and how to read it.
michaelvanstraten commentedon Dec 10, 2024
@alex-courtis sorry for the confusion. I will hopefully have the time to add some instructions later.
I will run the test in #2997 (comment) as soon as I am home from work.
Disable filesystem watchers in `nvim-tree`
TrevorHinesley commentedon Jan 13, 2025
FWIW @michaelvanstraten's change here fixes this for me, though that's obviously a nuclear option.
michaelvanstraten commentedon Jan 14, 2025
@TrevorHinesley i did the same, thank you.
1 remaining item