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

nvim-0.3.3 hangs at start with non-existing haskell file #2276

Closed
unode opened this issue Feb 5, 2019 · 7 comments
Closed

nvim-0.3.3 hangs at start with non-existing haskell file #2276

unode opened this issue Feb 5, 2019 · 7 comments
Labels

Comments

@unode
Copy link

unode commented Feb 5, 2019

Information

VIM version
NVIM v0.3.3
Build type: Release
LuaJIT 2.0.5

ale is commit 4d426bf

Operating System: Gentoo Linux

What went wrong

When I launch nvim with nvim path/to/non-existing.hs, nvim hangs at launch with cpu at 100%.
If I disable ale in vim's config file nvim launches normally.

Interestingly it seems to be something specific to haskell since I can't reproduce the same behavior with other languages (tried python, perl, c, bash)

Similarly, nvim non-existing.hs also works fine. The non-existing path/to makes a difference.

Reproducing the bug

/tmp/testrc is:

call plug#begin('~/.vim/bundle')
Plug 'w0rp/ale'
call plug#end()

and plug is https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim installed into nvim's autoload/.

  1. nvim -u /tmp/testrc path/to/nowhere.hs in urxvt
  2. nvim hangs in the terminal
  3. Press Ctrl+C and it resumes with some errors.

:ALEInfo

 Current Filetype: haskell                                                                                                                                                                                                                                                                                           
Available Linters: ['cabal_ghc', 'ghc', 'ghc_mod', 'hdevtools', 'hie', 'hlint', 'stack_build', 'stack_ghc']
   Linter Aliases:
'cabal_ghc' -> ['cabal-ghc']
'ghc_mod' -> ['ghc-mod']
'stack_build' -> ['stack-build']
'stack_ghc' -> ['stack-ghc']
  Enabled Linters: ['cabal_ghc', 'ghc', 'ghc_mod', 'hdevtools', 'hie', 'hlint', 'stack_build', 'stack_ghc']
 Suggested Fixers:
  'brittany' - Fix Haskell files with brittany.
  'hfmt' - Fix Haskell files with hfmt.
  'hlint' - Refactor Haskell files with hlint.
  'remove_trailing_lines' - Remove all blank lines at the end of a file.
  'stylish-haskell' - Refactor Haskell files with stylish-haskell.
  'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
 Linter Variables:
let g:ale_haskell_ghc_mod_executable = 'ghc-mod'
let g:ale_haskell_ghc_options = '-fno-code -v0'
let g:ale_haskell_hdevtools_executable = 'hdevtools'
let g:ale_haskell_hdevtools_options = '-g -Wall'
let g:ale_haskell_hie_executable = 'hie'
let g:ale_haskell_hlint_executable = 'hlint'
let g:ale_haskell_hlint_options = ''
 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_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 = 0
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
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_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_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:
(executable check - success) cabal
(finished - exit code 1) ['/bin/zsh', '-c', 'cabal exec -- ghc -fno-code -v0 ''/tmp/nvimRcX7mT/1/nowhere.hs''']
<<<OUTPUT STARTS>>>
/tmp/nvimRcX7mT/1/nowhere.hs:1:1:
    The IO action ‘main’ is not defined in module ‘Main’
<<<OUTPUT ENDS>>>
(executable check - success) ghc
(finished - exit code 1) ['/bin/zsh', '-c', 'ghc -fno-code -v0 ''/tmp/nvimRcX7mT/2/nowhere.hs''']
<<<OUTPUT STARTS>>>
/tmp/nvimRcX7mT/2/nowhere.hs:1:1:
    The IO action ‘main’ is not defined in module ‘Main’
<<<OUTPUT ENDS>>>
(executable check - success) ghc-mod
(finished - exit code 1) ['/bin/zsh', '-c', '''ghc-mod'' --map-file ''path/to/nowhere.hs''=''/tmp/nvimRcX7mT/3/nowhere.hs'' check ''path/to/nowhere.hs''']
<<<NO OUTPUT RETURNED>>>
(executable check - success) hdevtools
(finished - exit code 1) ['/bin/zsh', '-c', '''hdevtools'' check -g -Wall -p ''path/to/nowhere.hs'' ''/tmp/nvimRcX7mT/4/nowhere.hs''']
<<<NO OUTPUT RETURNED>>>
@w0rp
Copy link
Member

w0rp commented Feb 6, 2019

https://stackoverflow.com/a/12216578/1836507 Follow the steps here and attach a profile log. Usually problems with Vim hanging are caused by other plugins.

@w0rp w0rp added the triage label Feb 6, 2019
@unode
Copy link
Author

unode commented Feb 6, 2019

As I mentioned above I used a vimrc that only has ale in there and it still hangs.

I also tried:

nvim --startuptime /tmp/timeCost.txt path/to/nowhere.hs

and the last line printed before hanging is:

233.867  000.123  000.123: sourcing /data/bundle/ale/autoload/ale/path.vim

Profiling hangs after:
:e path/to/nowhere.hs
I then press Ctrl+C and quit.

Attached is the profile log

@w0rp
Copy link
Member

w0rp commented Feb 6, 2019

120155              0.414002         while empty(matchstr(l:cabal_file, '^\(\/\|\(\w:\\\)\)$'))
120155              0.210120             let l:cabal_file = fnamemodify(l:cabal_file, ':h')
120155              3.175341             let l:paths = l:paths . l:cabal_file . ','
120155              0.053781         endwhile

That's the issue. It looks like someone a loop which can run forever. Someone should fix that.

@w0rp w0rp added bug and removed triage labels Feb 6, 2019
@unode
Copy link
Author

unode commented Feb 7, 2019

CC'ing @Luxed as author based on the git log.
Any chance you could have a look at this?

@w0rp w0rp closed this as completed in 2885c57 Feb 7, 2019
@w0rp
Copy link
Member

w0rp commented Feb 7, 2019

I should have fixed this now. Give it a try.

@unode
Copy link
Author

unode commented Feb 7, 2019

Yup that works. Thanks!

@Luxed
Copy link
Contributor

Luxed commented Feb 7, 2019

:p woops, my bad, my knowledge of vim script and the weird way HIE works compared to other lsp (I discovered after pushing my changes that HIE scans for the project itself) led to a fix that wasn't as good as I wanted.
Anyway, thanks for the fix 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants