Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

haskell-lsp startup blocked #1133

Closed
ZichaoNickFox opened this issue Mar 13, 2019 · 7 comments
Closed

haskell-lsp startup blocked #1133

ZichaoNickFox opened this issue Mar 13, 2019 · 7 comments

Comments

@ZichaoNickFox
Copy link

Hi.

I blocked installing hie for one week. It seems installed successful, but when "go to declearation" or "rename", nothing happend.

environment:
windows 10
vscode
ghc 8.4.4
hie 0.7.0.0

Because of nothing happening. I run hie-wrapper in powershell. The log is shown as follow.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\liuzichao\Desktop\first-project> hie-wrapper.exe -d
2019-03-13 21:14:54.8289405 [ThreadId 3] - run entered for hie-wrapper(hie-wrapper.exe) Version 0.7.0.0 (2480 commits) x86_64 ghc-8.6.4
2019-03-13 21:14:54.8329294 [ThreadId 3] - Current directory:C:\Users\liuzichao\Desktop\first-project
2019-03-13 21:14:55.6846884 [ThreadId 3] - Cradle directory:C:\Users\liuzichao\Desktop\first-project
2019-03-13 21:14:55.6886414 [ThreadId 3] - Using stack GHC version
2019-03-13 21:14:55.9230147 [ThreadId 3] - Project GHC version:8.4.4
2019-03-13 21:14:55.9250089 [ThreadId 3] - hie exe candidates :["hie-8.4.4.exe","hie-8.4.exe","hie.exe"]
2019-03-13 21:14:55.9270031 [ThreadId 3] - found hie exe at:C:\Users\liuzichao\AppData\Roaming\local\bin\hie-8.4.4.exe
2019-03-13 21:14:55.9289977 [ThreadId 3] - args:["-d"]
2019-03-13 21:14:55.9299951 [ThreadId 3] - launching ....



2019-03-13 21:14:56.22022 [ThreadId 3] - Using stack GHC version
2019-03-13 21:14:56.4506035 [ThreadId 3] - Run entered for HIE(hie-8.4.4.exe) Version 0.7.0.0, Git revision 959ddf6c397e124722154d29178decaacf987109 (2466 commits) x86_64 ghc-8.4.4
2019-03-13 21:14:56.4555907 [ThreadId 3] - Current directory:C:\Users\liuzichao\Desktop\first-project
2019-03-13 21:14:56.4575854 [ThreadId 3] -




haskell-lsp:Starting up server ...

I think haskell-lsp caused this stuck. After stack install haskell-lsp, and run lsp-hello.exe, nothing changed shown in tmp/lsp-hello.log

2019-03-13 19:42:53.9254962 [ThreadId 1] - 




haskell-lsp:Starting up server ...

Please help me, thanks!

@fendor
Copy link
Collaborator

fendor commented Mar 13, 2019

On an abritrary project, I do not have this problem. Can you maybe share your project via git? Can you show the output of hie itself, e.g. from the vscode console? (click bottom left -> in the opened window press "Output" -> get output of "Haskell-HIE").
Also, if your project has a bunch of dependencies, it takes some time before HIE starts working because it builds the dependencies first.

@lukel97
Copy link
Collaborator

lukel97 commented Mar 13, 2019

To add to what was said above, hie-wrapper/hie/lsp-hello won't do anything or log anything when run from a console, they need to be run by the client (i.e. vscode) for anything interesting to happen.
If you select the verbose logging option for the Haskell Language Server in VS code's settings, there are also more logs output to $TMPDIR/hie.log on Unix: I'm not sure where exactly the equivalent path is on windows though!

@ZichaoNickFox
Copy link
Author

Thans for replay.

I use following command creating the project, which is in https://github.com/ZichaoNickFox/first-project

stack new --resolver=lts-12.26 first-project

The log of "Haskell HIE(first-project)" contains:

Warning: readStack:
         Bootstrapping stack project environment failed: readCreateProcess: C:\stack\stack.exe "path" (exit 1): failed
info: Found Stack project at: C:\Users\liuzichao\Desktop\first-project
Using hie version: Version 0.7.0.0, Git revision 959ddf6c397e124722154d29178decaacf987109 (2466 commits) x86_64 ghc-8.4.4
Warning: readStack:
         Bootstrapping stack project environment failed: readCreateProcess: C:\stack\stack.exe "path" (exit 1): failed
info: Found Cabal project at: C:\Users\liuzichao\Desktop\first-project
info: Using Cabal project at: C:\Users\liuzichao\Desktop\first-project
Using hoogle db at: C:\Users\liuzichao\AppData\Roaming\hoogle\default-haskell-5.0.17.hoo
info: Found Stack project at: C:\Users\liuzichao\Desktop\first-project
Warning: readStack:
         Bootstrapping stack project environment failed: readCreateProcess: C:\stack\stack.exe "path" (exit 1): failed
info: Found Cabal project at: C:\Users\liuzichao\Desktop\first-project
info: Using Cabal project at: C:\Users\liuzichao\Desktop\first-project

All of my apps installed in driver C, does administator authority make failure happen?

The log of Log(Extension Host) contains:

[2019-03-14 11:12:15.864] [exthost] [info] extension host started
[2019-03-14 11:12:15.884] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:15.884] [exthost] [info] ExtensionService#loadCommonJSModule c:\Users\liuzichao\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\debug-auto-launch\dist\extension
[2019-03-14 11:12:15.886] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:15.886] [exthost] [info] ExtensionService#loadCommonJSModule c:\Users\liuzichao\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\emmet\dist\extension
[2019-03-14 11:12:15.889] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:15.890] [exthost] [info] ExtensionService#loadCommonJSModule c:\Users\liuzichao\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\main
[2019-03-14 11:12:15.912] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:15.912] [exthost] [info] ExtensionService#loadCommonJSModule c:\Users\liuzichao\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\merge-conflict\dist\extension
[2019-03-14 11:12:15.914] [exthost] [info] ExtensionService#_doActivateExtension alefragnani.project-manager {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:15.914] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\alefragnani.project-manager-10.3.2\out\src\extension
[2019-03-14 11:12:15.928] [exthost] [info] ExtensionService#_doActivateExtension fcrespo82.markdown-table-formatter {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:15.928] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\fcrespo82.markdown-table-formatter-1.4.1\out\markdown-table-formatter
[2019-03-14 11:12:15.939] [exthost] [info] ExtensionService#_doActivateExtension Gruntfuggly.todo-tree {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:15.939] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\gruntfuggly.todo-tree-0.0.125\extension
[2019-03-14 11:12:16.121] [exthost] [info] ExtensionService#_doActivateExtension mihelcic.colored-regions {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:16.121] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\mihelcic.colored-regions-0.0.3\out\extension
[2019-03-14 11:12:16.122] [exthost] [info] ExtensionService#_doActivateExtension ryuta46.multi-command {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:16.122] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\ryuta46.multi-command-1.3.0\out\extension.js
[2019-03-14 11:12:16.124] [exthost] [info] ExtensionService#_doActivateExtension vscodevim.vim {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:16.124] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\vscodevim.vim-1.1.0\out\extension
[2019-03-14 11:12:16.361] [exthost] [info] ExtensionService#_doActivateExtension wayou.vscode-todo-highlight {"startup":true,"activationEvent":"*"}
[2019-03-14 11:12:16.361] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\wayou.vscode-todo-highlight-1.0.4\src\extension
[2019-03-14 11:12:16.364] [exthost] [info] ExtensionService#_doActivateExtension yzhang.markdown-all-in-one {"startup":true,"activationEvent":"workspaceContains:README.md"}
[2019-03-14 11:12:16.364] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\yzhang.markdown-all-in-one-2.1.1\out\src\extension
[2019-03-14 11:12:16.438] [exthost] [info] eager extensions activated
[2019-03-14 11:12:28.742] [exthost] [info] ExtensionService#_doActivateExtension justusadam.language-haskell {"startup":false,"activationEvent":"onLanguage:haskell"}
[2019-03-14 11:12:28.742] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\justusadam.language-haskell-2.5.0\out\src\extension
[2019-03-14 11:12:28.804] [exthost] [info] ExtensionService#_doActivateExtension alanz.vscode-hie-server {"startup":false,"activationEvent":"onLanguage:haskell"}
[2019-03-14 11:12:28.804] [exthost] [info] ExtensionService#loadCommonJSModule C:\Users\liuzichao\.vscode\extensions\alanz.vscode-hie-server-0.0.25\out\src\extension

use "rename" there is a processing bar flow from left to right in the top of the editor., with no changing in the log console. so does "haskell : Show type" and other commands.

@fendor
Copy link
Collaborator

fendor commented Mar 14, 2019

HIE does not seem to find your stack executable which seems weird.
Where is your stack executable?

@fendor
Copy link
Collaborator

fendor commented Apr 6, 2019

Can you try to execute stack path in your powershell?
Possibly in the project that you are trying to build/develop.

@asheshambasta
Copy link

asheshambasta commented Nov 14, 2019

I can reproduce this regularly with any large project on a Nix system. HIE just blocks on startup, and nothing really helps it start up post that.
I'm also completely unsure as to how HIE works, so I cannot really debug this further. If one can suggest to me resources to read up, I can probably debug this further and provide more helpful information.


The strange thing is, given I'm using emacs, I see no output after:

haskell-lsp:Starting up server ...

But if I terminate emacs, some output pops up:

haskell-lsp:Starting up server ...
2019-11-14 17:08:27.000343149 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 0.13.0.0 x86_64 ghc-8.4.4
2019-11-14 17:08:27.000570988 [ThreadId 4] - Current directory:/home/ashesh/code/centralapp/fractal
2019-11-14 17:08:27.000606024 [ThreadId 4] - Operating system:linux
2019-11-14 17:08:28.799014404 [ThreadId 4] - Cradle directory:/home/ashesh/code/centralapp/fractal
2019-11-14 17:08:28.799285645 [ThreadId 4] - Using stack GHC version
2019-11-14 17:08:30.592204786 [ThreadId 4] - Project GHC version:8.4.4
2019-11-14 17:08:30.592321917 [ThreadId 4] - hie exe candidates :["hie-8.4.4","hie-8.4","hie"]
2019-11-14 17:08:30.592592277 [ThreadId 4] - found hie exe at:/nix/store/v7bx55psr7zsq4lk5r1mrz0py77ng8rp-haskell-ide-engine-combined/libexec/bin/hie-8.4.4
2019-11-14 17:08:30.592636661 [ThreadId 4] - args:["--lsp","-d","-l","/tmp/hie.log"]
2019-11-14 17:08:30.592669183 [ThreadId 4] - launching ....

Given that I don't understand HIE deeply enough, I cannot say where this breaks.


Edit 1:

Another thing that I notice that going to the project dir. in the cli and executing hie seems to fire it up without issues:

╰─$ hie                                                                                                                                                                                              1 ↵
2019-11-14 17:17:31.975417748 [ThreadId 4] - run entered for hie-wrapper(hie) Version 0.13.0.0 x86_64 ghc-8.4.4
2019-11-14 17:17:31.976179893 [ThreadId 4] - Current directory:/home/ashesh/code/centralapp/fractal
2019-11-14 17:17:31.976509954 [ThreadId 4] - Operating system:linux
2019-11-14 17:17:33.759725387 [ThreadId 4] - Cradle directory:/home/ashesh/code/centralapp/fractal
2019-11-14 17:17:33.76016243 [ThreadId 4] - Using stack GHC version
2019-11-14 17:17:35.552418736 [ThreadId 4] - Project GHC version:8.4.4
2019-11-14 17:17:35.552748456 [ThreadId 4] - hie exe candidates :["hie-8.4.4","hie-8.4","hie"]
2019-11-14 17:17:35.553310595 [ThreadId 4] - found hie exe at:/nix/store/v7bx55psr7zsq4lk5r1mrz0py77ng8rp-haskell-ide-engine-combined/libexec/bin/hie-8.4.4
2019-11-14 17:17:35.553879456 [ThreadId 4] - args:[]
2019-11-14 17:17:35.554087057 [ThreadId 4] - launching ....



2019-11-14 17:17:35.813371119 [ThreadId 4] - Using stack GHC version
2019-11-14 17:17:37.606870813 [ThreadId 4] - Run entered for HIE(hie-8.4.4) Version 0.13.0.0 x86_64 ghc-8.4.4
2019-11-14 17:17:37.607346909 [ThreadId 4] - Current directory:/home/ashesh/code/centralapp/fractal
2019-11-14 17:17:37.607729289 [ThreadId 4] - args:[]


However, when I pass it the flags:

╰─$ hie --lsp -d -l /tmp/hie.log   

I then see the logs that seems to suggest hie hangs:

2019-11-14 17:16:59.890204883 [ThreadId 4] - run entered for hie-wrapper(hie) Version 0.13.0.0 x86_64 ghc-8.4.4
2019-11-14 17:16:59.890420329 [ThreadId 4] - Current directory:/home/ashesh/code/centralapp/fractal
2019-11-14 17:16:59.890456938 [ThreadId 4] - Operating system:linux
2019-11-14 17:17:01.682857526 [ThreadId 4] - Cradle directory:/home/ashesh/code/centralapp/fractal
2019-11-14 17:17:01.683091957 [ThreadId 4] - Using stack GHC version
2019-11-14 17:17:03.494052754 [ThreadId 4] - Project GHC version:8.4.4
2019-11-14 17:17:03.494172039 [ThreadId 4] - hie exe candidates :["hie-8.4.4","hie-8.4","hie"]
2019-11-14 17:17:03.494416369 [ThreadId 4] - found hie exe at:/nix/store/v7bx55psr7zsq4lk5r1mrz0py77ng8rp-haskell-ide-engine-combined/libexec/bin/hie-8.4.4
2019-11-14 17:17:03.494457166 [ThreadId 4] - args:["--lsp","-d","-l","/tmp/hie.log"]
2019-11-14 17:17:03.494486531 [ThreadId 4] - launching ....



2019-11-14 17:17:03.754759746 [ThreadId 4] - Using stack GHC version
2019-11-14 17:17:05.547201516 [ThreadId 4] - Run entered for HIE(hie-8.4.4) Version 0.13.0.0 x86_64 ghc-8.4.4
2019-11-14 17:17:05.547341219 [ThreadId 4] - Current directory:/home/ashesh/code/centralapp/fractal
2019-11-14 17:17:05.547372367 [ThreadId 4] - args:["--lsp","-d","-l","/tmp/hie.log"]
2019-11-14 17:17:05.547440115 [ThreadId 4] - 




haskell-lsp:Starting up server ...

Edit 2:

It seems to me that the issue is related to lsp-haskell and the lack of support for emacs native-json that was introduced in emacs-27. I could not reproduce this issue after downgrading emacs (all thanks to nixos for making this painless). And indeed, there seems to be an issue open: emacs-lsp/lsp-haskell#48 that could be the reason behind this.

It also makes sense overall, I believe HIE needs some data-exchange between itself and emacs to start up, which doesn't seem to happen and the process looks "hung". I'm not sure if my assumption here is correct (clarifications will be helpful).

@jneira
Copy link
Member

jneira commented Dec 21, 2019

@ZichaoNickFox this could be fixed by the new hie architecture already in master, feel free to reopen if you continue experiencing the issue with master

@jneira jneira closed this as completed Dec 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants