haskell / haskell-language-server

Official haskell ide support via language server (LSP). Successor of ghcide & haskell-ide-engine.
Apache License 2.0
2.72k stars 368 forks source link

HLS hangs on "Processing..." and does not finish even after hours of waiting #4369

Closed Ai-Ya-Ya closed 3 months ago

Ai-Ya-Ya commented 3 months ago

Your environment

Which OS do you use:

Windows 10

Using Stack v3.1.1, GHC 9.6.6

Steps to reproduce

  1. Create a rio Stack project: stack new new-project rio
  2. (Optional) Restart Haskell LSP server

Expected behaviour

I expect the extension to finish processing.

Actual behaviour

The extension is stuck on "Processing: 2/3" or "...3/3" or something like that. I have waited seven hours and yet it still hangs.

Include debug information

Execute in the root of your project the command haskell-language-server-wrapper --debug . and paste the logs here (you can find the executable location here):

There is no progress beyond the point I cut off.

Debug output: ``` No 'hie.yaml' found. Try to discover the project type! Run entered for haskell-language-server-wrapper(haskell-language-server-wrapper-2.4.0.0.exe) Version 2.4.0.0 x86_64 ghc-9.4.7 Current directory: C:\Users\Allen\Documents\MMSimulator Operating system: mingw32 Arguments: ["--debug"] Cradle directory: C:\Users\Allen\Documents\MMSimulator Cradle type: Stack Tool versions found on the $PATH cabal: 3.6.2.1 stack: 2.11.1 ghc: 9.4.7 Consulting the cradle to get project GHC version... 2024-07-31T17:18:16.182919Z | Debug | executing command: stack setup --silent 2024-07-31T17:18:21.365419Z | Debug | executing command: stack exec ghc -- --numeric-version Project GHC version: 9.6.6 haskell-language-server exe candidates: ["haskell-language-server-9.6.6.exe","haskell-language-server.exe"] Failed to find a HLS version for GHC 9.6.6 Executable names we failed to find: haskell-language-server-9.6.6.exe,haskell-language-server.exe 2024-07-31T17:18:22.178668Z | Info | Starting server ```

Paste the contents of extension specific log, you can check instructions about how to find it here

Note the absurd number of "heap size" logs the extension prints while making zero progress.

Extension log: ``` Pasting in separate file, too large here ``` [logs.txt](https://github.com/user-attachments/files/16445180/logs.txt)
fendor commented 3 months ago

Hi, thank you for opening the issue!

I transferred this issue to Haskell-language-server, as this is likely a bug with the backend, not the plugin.

fendor commented 3 months ago

This feels to me like a stack bug, see:

$ rm -rf .stack-work
$ stack repl new-project:exe:new-project-exe
Using main module:
1.  Package new-project, component new-project:exe:new-project-exe, with main-is file: /home/hugin/Documents/haskell/new-project/app/Main.hs.

new-project> configure (lib + exe)
Configuring new-project-0.1.0.0...
new-project> initial-build-steps (lib + exe)

Warning: The following GHC options are incompatible with GHCi and have not been passed to it: -threaded.

Configuring GHCi with the following packages: new-project.
GHCi, version 9.6.6: https://www.haskell.org/ghc/  :? for help
<command line>: cannot satisfy -package new-project-0.1.0.0
    (use -v for more information)

Looks like https://github.com/commercialhaskell/stack/issues/5380 or some variant of it.

Note, HLS (and stack) work fine if you run stack build first.

$ stack build
new-project> build (lib + exe) with ghc-9.6.6
Preprocessing library for new-project-0.1.0.0..
Building library for new-project-0.1.0.0..
[1 of 5] Compiling Paths_new_project
[2 of 5] Compiling Types
[3 of 5] Compiling Import
[4 of 5] Compiling Run
[5 of 5] Compiling Util
Preprocessing executable 'new-project-exe' for new-project-0.1.0.0..
Building executable 'new-project-exe' for new-project-0.1.0.0..
[1 of 2] Compiling Paths_new_project
[2 of 2] Compiling Main
[3 of 3] Linking .stack-work/dist/x86_64-linux/ghc-9.6.6/build/new-project-exe/new-project-exe
new-project> copy/register
Installing library in /home/hugin/Documents/haskell/new-project/.stack-work/install/x86_64-linux/de2f04e00fd5344eebce6aa8b9e0698e7ec33c4b17bf7fc18a6f9f06a31d9a2f/9.6.6/lib/x86_64-linux-ghc-9.6.6/new-project-0.1.0.0-E8HzAoMocoqDnGWrx6FaFD
Installing executable new-project-exe in /home/hugin/Documents/haskell/new-project/.stack-work/install/x86_64-linux/de2f04e00fd5344eebce6aa8b9e0698e7ec33c4b17bf7fc18a6f9f06a31d9a2f/9.6.6/bin
Registering library for new-project-0.1.0.0..
$ stack repl new-project:exe:new-project-exe
Using main module:
1.  Package new-project, component new-project:exe:new-project-exe, with main-is file: /home/hugin/Documents/haskell/new-project/app/Main.hs.

Warning: The following GHC options are incompatible with GHCi and have not been passed to it: -threaded.

Configuring GHCi with the following packages: new-project.
GHCi, version 9.6.6: https://www.haskell.org/ghc/  :? for help
[1 of 3] Compiling Paths_new_project ( /home/hugin/Documents/haskell/new-project/.stack-work/dist/x86_64-linux/ghc-9.6.6/build/new-project-exe/autogen/Paths_new_project.hs, interpreted )
[2 of 3] Compiling Main             ( /home/hugin/Documents/haskell/new-project/app/Main.hs, interpreted )
Ok, two modules loaded.
Loaded GHCi configuration from /home/hugin/.cache/stack/ghci-script/45022edf/ghci-script
ghci> :q
Leaving GHCi.
fendor commented 3 months ago

Relevant HLS issue: #366

fendor commented 3 months ago

Closing as duplicate, but feel free to comment if I am missing something!