dense-analysis / dense-analysis/ale

Long hangups in python files on slow filesystem (webDav) due to vim function "filereadable"

Open
#4,267 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Vim Script
Stars
14k
Forks
1.5k
Avg merge
17h 49m
Merged PRs (30d)
1

Description

## Information

**VIM version**

NVIM v0.7.2
Build type: RelWithDebInfo

Fedora Linux 36 (Workstation Edition)

## What went wrong

When open any file on a secure webDav mounted via Nautilus with default options (but probably on all slow filesystems), I experience a few lockups (~10s) when:

* When it's started.
* Change to normal mode from insert mode and move the cursor

It seems to be related to the function `filereadable` (see "Profiling Info" section).
May be related to #2021.

## Reproducing the bug

1. Open any python file on a slow filesystem
2. Experience the hangup at startup or from any change to normal mode from insert mode and move the cursor

## Profiling Info
Using:
```
:profile ~/vim_profile.log
:profile file *
:profile func *
```
I get
```
FUNCTION ale#python#FindVirtualenv()
Defined: ~/.config/nvim/plugged/ale/autoload/ale/python.vim:73
Called 3 times
Total time: 7.914282
Self time: 7.909655

count total (s) self (s)
30 0.210436 0.210115 for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
" Skip empty path components returned in MSYS.
27 0.000040 if empty(l:path)
continue
27 0.000009 endif

216 0.000863 0.000556 for l:dirname in ale#Var(a:buffer, 'virtualenv_dir_names')
189 0.004879 0.002469 let l:venv_dir = ale#path#Simplify( join([l:path, l:dirname], s:sep))
189 0.003016 0.001427 let l:script_filename = ale#path#Simplify( join([l:venv_dir, s:bin_dir, 'activate'], s:sep))

189 7.693286 if filereadable(l:script_filename)
return l:venv_dir
189 0.000130 endif
216 0.000141 endfor
30 0.000013 endfor

3 0.000013 return $VIRTUAL_ENV
[...]
FUNCTION ale#python#FindProjectRootIni()
Defined: ~/.config/nvim/plugged/ale/autoload/ale/python.vim:20
Called 1 time
Total time: 6.884652
Self time: 6.884544

count total (s) self (s)
10 0.074985 0.074878 for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
" If you change this, update ale-python-root documentation.
9 6.809587 if filereadable(l:path . '/MANIFEST.in')|| filereadable(l:path . '/setup.cfg')|| filereadable(l:path . '/pytest.ini')|| filereadable(l:path . '/tox.ini')|| filereadable(l:path . '/.pyre_configuration.local')|| filereadable(l:path . '/mypy.ini')|| filereadable(l:path . '/.mypy.ini')|| filereadable(l:path . '/pycodestyle.cfg')|| filereadable(l:path . '/.flake8')|| filereadable(l:path . '/.flake8rc')|| filereadable(l:path . '/pylama.ini')|| filereadable(l:path . '/pylintrc')|| filereadable(l:path . '/.pylintrc')|| filereadable(l:path . '/Pipfile')|| filereadable(l:path . '/Pipfile.lock')|| filereadable(l:path . '/poetry.lock')|| filereadable(l:path . '/pyproject.toml')|| filereadable(l:path . '/.tool-versions')
return l:path
9 0.000006 endif
10 0.000006 endfor

1 0.000001 return ''

[...]
FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
3 7.914282 7.909655 ale#python#FindVirtualenv()
1 6.884652 6.884544 ale#python#FindProjectRootIni()
1 6.998195 0.113421 ale#python#FindProjectRoot()
[...]
```

### :ALEInfo

```
Current Filetype: python
Available Linters: ['bandit', 'cspell', 'flake8', 'flakehell', 'jedils', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pylsp', 'pyre', 'pyright', 'unimport', 'vulture']
Enabled Linters: ['flake8', 'mypy', 'pylint', 'pyright']
Ignored Linters: []
Suggested Fixers:
'add_blank_lines_for_python_control_statements' - Add blank lines before control statements.
'autoflake' - Fix flake issues with autoflake.
'autoimport' - Fix import issues with autoimport.
'autopep8' - Fix PEP8 issues with autopep8.
'black' - Fix PEP8 issues with black.
'isort' - Sort Python imports with isort.
'pyflyby' - Tidy Python imports with pyflyby.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'reorder-python-imports' - Sort Python imports with reorder-python-imports.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'yapf' - Fix Python files with yapf.
Linter Variables:

let g:ale_python_auto_pipenv = 0
let g:ale_python_auto_poetry = 0
let g:ale_python_flake8_auto_pipenv = 0
let g:ale_python_flake8_auto_poetry = 0
let g:ale_python_flake8_change_directory = 'project'
let g:ale_python_flake8_executable = 'flake8'
let g:ale_python_flake8_options = ''
let g:ale_python_flake8_use_global = 0
let g:ale_python_mypy_auto_pipenv = 0
let g:ale_python_mypy_auto_poetry = 0
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_ignore_invalid_syntax = 0
let g:ale_python_mypy_options = ''
let g:ale_python_mypy_show_notes = 1
let g:ale_python_mypy_use_global = 0
let g:ale_python_pylint_auto_pipenv = 0
let g:ale_python_pylint_auto_poetry = 0
let g:ale_python_pylint_change_directory = 1
let g:ale_python_pylint_executable = 'pylint'
let g:ale_python_pylint_options = ''
let g:ale_python_pylint_use_global = 0
let g:ale_python_pylint_use_msg_id = 0
let g:ale_python_pyright_config = {}
let g:ale_python_pyright_executable = 'pyright-langserver'
Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:

(finished - exit code 127) ['/bin/bash', '-c', '''pylint'' --version']

<<>>
/bin/bash: line 1: pylint: command not found
<<>>

(executable check - failure) flake8
(executable check - failure) mypy
(executable check - failure) pylint
(executable check - failure) pyright-langserver
(finished - exit code 127) ['/bin/bash', '-c', '''pylint'' --version']

<<>>
/bin/bash: line 1: pylint: command not found
<<>>

(executable check - failure) flake8
(executable check - failure) mypy
(executable check - failure) pylint
(executable check - failure) pyright-langserver
(finished - exit code 127) ['/bin/bash', '-c', '''pylint'' --version']

<<>>
/bin/bash: line 1: pylint: command not found
<<>>

(executable check - failure) flake8
(executable check - failure) mypy
(executable check - failure) pylint
(executable check - failure) pyright-langserver
(finished - exit code 127) ['/bin/bash', '-c', '''pylint'' --version']

<<>>
/bin/bash: line 1: pylint: command not found
<<>>

(executable check - failure) flake8
(executable check - failure) mypy
(executable check - failure) pylint
(executable check - failure) pyright-langserver
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.