Closed miversen33 closed 1 year ago
After a bit of thinking while submitting this, I wonder if this issue is actually present on linux machines as well, if they have a very slow network connection.
What appears to be happening is that Windows is actually killing the processes after a while, likely to due it believing they are "stale" or "bad". I imagine that the Linux Kernel will do the same thing with "stuck" linux processes if there are a ton of them and they all "appear" to be not moving. Just a theory, I am not completely sure here.
It's not an issue on Linux and also not an issue on my windows machine.
You can configure the concurrency in lazy. See for more details in the readme.
Fyi: synching takes less than 3seconds for me for over 100 plugins
Is "Works on my machine" really a valid closure reason...?
Setting concurrency to "something lower" in lazy does not resolve the issue, I am still seeing tons of Git for Windows
and sh.exe
processes and I am seeing CPU usage of the powershell process that Neovim is running in max out.
I can confirm that setting the Concurrency value to something low (such as 15 in this case) does allow Lazy to successfully complete, it just takes forever on my Windows environment. Note, on the same machine in WSL it does not take nearly as long. Additionally running on linux machines in my network I see comparable times to what you see mentioned
More details I am able to find.
I can manually run git to pull any of the plugins listed and it runs as fast as you would expect a git clone to run, so I don't believe its actually an issue with Git (or the network connection on the windows machine).
I cannot run Profile
without setting concurrency to something low as eventually Lazy fails due to Git processes being killed (I am unsure if they are being killed by Lazy or Windows, I did not initially notice that Lazy has a git timeout variable).
When I set concurrency to 15
, it takes about 7 minutes to fully download all 75 plugins on windows using the above listed repro.lua
.
On WSL on the same machine it takes less than 1 second for lazy to finish
And on a completely separate linux machine on the network
All these are ran on the same network over the same wifi network. What else can I provide to help here? Something is wrong and I don't really know what.
I think this is just a Windows issue. Not sure if there's anything that can be done about that. Windows just doesn't seem to be able to cope well with a lot of processes.
Lazy just spawns the git processes.
On Windows for me it is also slower, but not that much compared to linux.
You seem to be using https://gitforwindows.org/ This starts git in an emulated bash environment. Pretty sure that's the problem here. I use regular git on Windows.
I use regular git on Windows.
Could you elaborate on that? What do you mean by "regular git on Windows"? Do you mean you download the git source code and build it yourself? Do you mean wsl git? Or do you mean the windows binaries available for download from git-scm.com (those are the same binaries as gitforwindows.org)?
This starts git in an emulated bash environment.
That shouldn't be the case, unless you're explicitly launching that bash or running a part of Git that is implemented as a shell script.
winget install Git.Git
. Might indeed be the same then. No idea. I don't regularly use Windows.
As you can see from OP's screenshot, there's a lot of sh.exe
processes started as well, so I assume those are from the git exe.
This might also be useful: https://github.com/git-for-windows/git/wiki/Diagnosing-performance-issues
As I said before, all lazy does is use libuv to spawn a git process. I'm not doing anything special with shells or anything like that.
On my Windows 11 system, I don't have any problems. It's a bit slower than linux, but not a big difference.
I've also just pushed a change to configure concurrency on Windows by default. It seems that Windows simply can't cope with a lot of processes being spawned.
I cannot run
Profile
without setting concurrency to something low as eventually Lazy fails due to Git processes being killed (I am unsure if they are being killed by Lazy or Windows, I did not initially notice that Lazy has a git timeout variable).
Does increasing that timeout also cause lazy to install all (or most) plugins?
I'm assuming the git clone
processes take over 2 minutes each with high-ish concurrency for whatever reason and Lazy ends up killing them.
You can change the timeout in the lazy config as well.
winget install Git.Git
. Might indeed be the same then. No idea. I don't regularly use Windows.
That is indeed also the same.
As you can see from OP's screenshot, there's a lot of
sh.exe
processes started as well, so I assume those are from the git exe.
Yes, though I assume those are spawned from within the initial git clone
process to do some thing that git uses a shell for. Maybe --recurse-submodules
.
On my Windows 11 system, I don't have any problems. It's a bit slower than linux, but not a big difference.
Yes, that could very well be git-for-windows/git#4459, that issue seems to mainly affect domain joined machines.
I've also just pushed a change to configure concurrency on Windows by default. It seems that Windows simply can't cope with a lot of processes being spawned.
Seems like a good workaround.
I'll give this update a try this morning.
I want to call out that my testing so far has been on both a domain joined machine using VPN (my work computer) and a non-domain joined, LAN connected virtual machine (my personal windows test vm), with the same results. So wildly different setups, and I don't believe the domain joined bit specifically is causing any issues here. I'll post an update later once I have had an opportunity to test this out
@folke so good news and bad news. The good news, your update (the default change the concurrency) does appear to "work". Lazy is quite slow still, but that is due to there only being (from the looks of it) processors * 2
processes allowed to run at once. It does not cause timeouts, windows does not blow up, and it does finish all plugin downloads from the above Repro.
As we can see, still very slow but I agree that the lack of speed here is likely a Git for Windows
thing.
The bad news, I did still see lots of processes spawn up, but not nearly the same as before, with my CPU usage for the parent process capping at 10-14% usage. So much better!
I appreciate you taking the time to investigate this more :)
I'm facing the same timeout problems in Sonoma, so I upgraded to 14.5, but it's the same.
Sync (S)
used to run very quickly, but since a couple of days I've been getting timeouts in some of the plugins on the list, usually 4-5 and not always the same.
I did not change the concurrency configuration because it worked well as is, so I am not sure if this is a new issue on macOS, lazy, or Github.
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.9.1
Operating system/version
Windows 10
Describe the bug
When setting up my dotfiles on a windows machine, I notice that Lazy fails to install pretty much any of the plugins I have specified for it. Additionally, my windows machine slows to an absolute crawl for about 5 minutes.
After digging into the task manager, I noticed that there are tons of
Git for Windows
andsh.exe
processes that are being started and killed all the time. I have tested this both on my work laptop (which has an antivirus) and a personal Windows 10 vm (which only has Windows defender) and noticed the same result. A screenshot can be found belowEventually Lazy will just fail with an error by each plugin stating that it was unable to download them
My plugin list isn't exactly "huge", its about 74 plugins. It can be found here though I imagine it will be an issue with pretty much any list of plugins as the issue happens during
git clone
and not setup.If there is more info you need (or if there are things you need tested), please let me know!
Steps To Reproduce
Expected Behavior
I am going to guess that the issue is that Lazy is spawning a new git process for each plugin (maybe all at once, I am not completely sure and haven't really dug into the source of Lazy). Is there a way to configure a limit to the number of processes that are spawned and/or have Lazy use a process pool to reuse processes as opposed to creating new ones? It seems git on Windows is quite a bit slower than git on Linux, which is likely what is contributing to this issue.
It's worth noting that if you manually comment out blocks of plugins and let Lazy setup "less" plugins at once, it does kick through eventually. Basically manually performing the above process limiting.
Repro