Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round Number Delay When Starting Under WSL #1831

Closed
alex-courtis opened this issue Dec 17, 2022 · 11 comments · Fixed by #1868
Closed

Round Number Delay When Starting Under WSL #1831

alex-courtis opened this issue Dec 17, 2022 · 11 comments · Fixed by #1868
Labels
awaiting feedback bug Something isn't working OS Windows PowerShell specific to windows powershell OS Windows WSL specific to windows WSL

Comments

@alex-courtis
Copy link
Member

alex-courtis commented Dec 17, 2022

Multiple WSL users have reported issues with a freeze on startup, always a round number: 20s, 100s, 60s

Git enabled 20s: #1719

Git disabled 60s/100s: #549 (comment)

@alex-courtis alex-courtis added the bug Something isn't working label Dec 17, 2022
@alex-courtis
Copy link
Member Author

alex-courtis commented Dec 17, 2022

Originally posted by @pedro2d10 in #549 (comment)

I've added some more profiling to hopefully narrow down on the issue. Please pull latest 95ed588 and enable profiling

Here the following logs:

[2022-12-16 08:57:24] [profile] START core init /home/pierre/.config/nvim
[2022-12-16 08:57:24] [watcher] Watcher:new '/home/pierre/.config/nvim' nil
[2022-12-16 08:57:24] [watcher] Event:new '/home/pierre/.config/nvim'
[2022-12-16 08:57:24] [watcher] Event:start '/home/pierre/.config/nvim'
[2022-12-16 08:57:24] [profile] START explore init /home/pierre/.config/nvim
[2022-12-16 08:58:24] [watcher] Watcher:new '/home/pierre/.config/nvim/lua' nil
[2022-12-16 08:58:24] [watcher] Event:new '/home/pierre/.config/nvim/lua'
[2022-12-16 08:58:24] [watcher] Event:start '/home/pierre/.config/nvim/lua'
[2022-12-16 08:58:24] [watcher] Watcher:new '/home/pierre/.config/nvim/plugin' nil
[2022-12-16 08:58:24] [watcher] Event:new '/home/pierre/.config/nvim/plugin'
[2022-12-16 08:58:24] [watcher] Event:start '/home/pierre/.config/nvim/plugin'
[2022-12-16 08:58:24] [profile] END   explore init /home/pierre/.config/nvim  60178ms
[2022-12-16 08:58:24] [profile] END   core init /home/pierre/.config/nvim  60179ms
[2022-12-16 08:58:24] [profile] START view open
[2022-12-16 08:58:24] [profile] END   view open  9ms
[2022-12-16 08:58:24] [profile] START draw
[2022-12-16 08:58:24] [profile] END   draw  0ms

As you can see, there 60s between profiling start and watcher.

I hope this will help

@alex-courtis
Copy link
Member Author

vim.loop.fs_scandir_next may be an issue as that is called at least once before creating the watcher.

The round numbers hint at possible timeout from the OS.

There is no configurable timeout.

Wrapping and profiling could confirm.

@alex-courtis
Copy link
Member Author

@pedro2d10 error handling has been improved and more profiling has been added. I would be most grateful if you could test again.

@pedro2d10
Copy link

Here the new logs:

[2022-12-17 08:51:16] [profile] START core init /home/pierre/.config/nvim
[2022-12-17 08:51:16] [watcher] Watcher:new '/home/pierre/.config/nvim' nil
[2022-12-17 08:51:16] [watcher] Event:new '/home/pierre/.config/nvim'
[2022-12-17 08:51:16] [watcher] Event:start '/home/pierre/.config/nvim'
[2022-12-17 08:51:16] [profile] START fs_scandir /home/pierre/.config/nvim
[2022-12-17 08:51:16] [profile] END   fs_scandir /home/pierre/.config/nvim  0ms
[2022-12-17 08:51:16] [profile] START explore init /home/pierre/.config/nvim
[2022-12-17 08:51:16] [profile] START fs_scandir_next /home/pierre/.config/nvim
[2022-12-17 08:51:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim  0ms
[2022-12-17 08:51:16] [profile] START fs_scandir /home/pierre/.config/nvim/.git
[2022-12-17 08:51:16] [profile] END   fs_scandir /home/pierre/.config/nvim/.git  0ms
[2022-12-17 08:51:16] [profile] START fs_scandir_next /home/pierre/.config/nvim/.git
[2022-12-17 08:51:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim/.git  0ms
[2022-12-17 08:51:16] [profile] START fs_scandir_next /home/pierre/.config/nvim
[2022-12-17 08:51:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim  0ms
[2022-12-17 08:52:16] [profile] START fs_scandir_next /home/pierre/.config/nvim
[2022-12-17 08:52:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim  0ms
[2022-12-17 08:52:16] [profile] START fs_scandir_next /home/pierre/.config/nvim
[2022-12-17 08:52:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim  0ms
[2022-12-17 08:52:16] [profile] START fs_scandir_next /home/pierre/.config/nvim
[2022-12-17 08:52:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim  0ms
[2022-12-17 08:52:16] [profile] START fs_scandir /home/pierre/.config/nvim/lua
[2022-12-17 08:52:16] [profile] END   fs_scandir /home/pierre/.config/nvim/lua  0ms
[2022-12-17 08:52:16] [profile] START fs_scandir_next /home/pierre/.config/nvim/lua
[2022-12-17 08:52:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim/lua  0ms
[2022-12-17 08:52:16] [watcher] Watcher:new '/home/pierre/.config/nvim/lua' nil
[2022-12-17 08:52:16] [watcher] Event:new '/home/pierre/.config/nvim/lua'
[2022-12-17 08:52:16] [watcher] Event:start '/home/pierre/.config/nvim/lua'
[2022-12-17 08:52:16] [profile] START fs_scandir_next /home/pierre/.config/nvim
[2022-12-17 08:52:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim  0ms
[2022-12-17 08:52:16] [profile] START fs_scandir /home/pierre/.config/nvim/plugin
[2022-12-17 08:52:16] [profile] END   fs_scandir /home/pierre/.config/nvim/plugin  0ms
[2022-12-17 08:52:16] [profile] START fs_scandir_next /home/pierre/.config/nvim/plugin
[2022-12-17 08:52:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim/plugin  0ms
[2022-12-17 08:52:16] [watcher] Watcher:new '/home/pierre/.config/nvim/plugin' nil
[2022-12-17 08:52:16] [watcher] Event:new '/home/pierre/.config/nvim/plugin'
[2022-12-17 08:52:16] [watcher] Event:start '/home/pierre/.config/nvim/plugin'
[2022-12-17 08:52:16] [profile] START fs_scandir_next /home/pierre/.config/nvim
[2022-12-17 08:52:16] [profile] END   fs_scandir_next /home/pierre/.config/nvim  0ms
[2022-12-17 08:52:16] [profile] END   explore init /home/pierre/.config/nvim  60288ms
[2022-12-17 08:52:16] [profile] END   core init /home/pierre/.config/nvim  60289ms
[2022-12-17 08:52:16] [profile] START view open
[2022-12-17 08:52:16] [profile] END   view open  11ms
[2022-12-17 08:52:16] [profile] START draw
[2022-12-17 08:52:16] [profile] END   draw  0ms

On line 15, there is exactly a 60s delay befaore it goes to the next step.

@alex-courtis alex-courtis added the OS Windows WSL specific to windows WSL label Dec 18, 2022
@alex-courtis
Copy link
Member Author

Thanks @pedro2d10

I've attempted replication with a dummy directory populated after git init: 1831.tar.gz

After cleaning:

40,41c40,41
< [profile] END   explore init /path/to/nvim  60288ms
< [profile] END   core init /path/to/nvim  60289ms
---
> [profile] END   explore init /path/to/nvim  1ms
> [profile] END   core init /path/to/nvim  1ms
43c43
< [profile] END   view open  11ms
---
> [profile] END   view open  2ms

@alex-courtis
Copy link
Member Author

alex-courtis commented Dec 19, 2022

There's a lot of file system operations taking place to detect whether a file is executable:

@pedro2d10 I would be most grateful if you could test with a branch that removes this check:

cd /path/to/nvim-tree.lua
git pull
git checkout 1831-test-skipping-executable-check

Possible actions:

  • Disable executable checks on windows by default
  • Diagnose and fix performance issue
  • Remove executable functionality on windows

@pedro2d10
Copy link

@alex-courtis you're a genius! It work great now. There's no delay when nvim-tree open.

Let me now if you want me to send you come log or change parameters.

@alex-courtis
Copy link
Member Author

@doanamo I would be grateful if you could take a look at this one: node-builders.is_executable is experiencing these delays.

I don't have a windows machine so I cannot investigate.

@alex-courtis
Copy link
Member Author

alex-courtis commented Dec 23, 2022

I do not know whether powershell/msys executable detection works either, which uses a different codepath.

The wsl code is buggy and is expensive, making many FS calls.

This is the only WSL specific codepath. Other windows codepaths are needed:

  • git
  • trash
  • create file
  • system open

We don't have the expertise or means to test these windows specific codepaths. I would like to remove executable flag functionality under windows. @gegoune ?

@gegoune
Copy link
Collaborator

gegoune commented Dec 24, 2022

I don't have ability to test windows either. Unless someone steps in and offers help I think removing that single functionality isn't big problem. Will just need a small info that this functionality is not available on that platform.

@alex-courtis
Copy link
Member Author

Will just need a small info that this functionality is not available on that platform.

Good call.

https://github.com/nvim-tree/nvim-tree.lua/pull/1868/files#diff-b5b2d1abcb86ead5a2319f7e065a7545b834a407cc9f420590d7acebb285fca9

alex-courtis added a commit that referenced this issue Dec 31, 2022
… vim freeze and performance concerns (#1868)

* #1831 exploratory testing: disable file executable checks

* fix(#1831): remove windows executable functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback bug Something isn't working OS Windows PowerShell specific to windows powershell OS Windows WSL specific to windows WSL
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants