-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
HLS crashes in vscode with Prelude.head: empty list
#2118
Comments
Update: the problem ( |
Cleaning up the imports made the problem ( |
Here's the minimum diff that makes it crash again:
|
More problems due to |
wow many thanks for reducing the repro case at its minimum, could be related with template haskell, as importing Lens' triggers the bug? |
Hi @jneira! 🤔 Aren't Lens and Lens' defined in the same file, and isn't Lens' just a specialized type synonym for Lens with a~ b and s~ t? |
Is there a way to get a stack trace from hls? |
I just confirmed that the issue is adding Edit: no problem with |
I'm currently rebuilding hls with profiling... |
Prelude.head: empty list
building hls with profiling is turning out to be cumbersome:
|
A contribution adding a failing test to the ghcide test suite would be very welcome. Even better if it removes one or more of the |
First I have to figure out which one bites us here, and setting up profiling is a challenge yet to overcome. It could even be in a third-party library. |
A lot of the To increase the chances of your profiled build, try turning off dynamic linking |
thanks for the suggestion to deactivate dynamic linking. I was able to build hls successfully with profiling with dynamic linking turned off. Unfortunately, hls does not work without it on macOS. I'm seeing errors like:
|
quick update: after resolving #2117, I was able to build and use hls with profiling on linux. Unfortunately,
I think there's an async timeout that is being triggered all the time, and that is responsible for all the traces I'm seeing:
|
I found out that the vscode logs are being streamed to |
OK, that's enough time wasted with profiling. Let me know if anyone wants a dump of all that data. It seems that in hls, exceptions are being thrown all the time which makes this sort of analysis utterly useless. Here is one that I'm seeing over and over again:
|
I did find something eventually:
|
Seeing that where the issue is coming from here:
Basically there's logic that is trying to un-qualify the symbol. It does that by findind the last '.' in the symbol name and calls head on what follows. But in the case of '^.' there's nothing following the last dot, thus the error. |
Wow, déjà vu.
You went through the same steps and identified the same cause as I did 🙌🏻 Let me see if I can verify that the problems have the same root. |
update: I have verified that this issue, #2118, is a duplicate of #2025. I have also verified that
|
This is not a duplicate of #2117 as the issue occurs on a different platform (macOS instead of NixOS) and manifests differently.
The HLS crashes five times in a row while working on this file:
https://github.com/hasktorch/hasktorch/blob/744dc4aff70719c9149807e40dacce59fd77484c/experimental/gradually-typed/src/Torch/GraduallyTyped/NN/Transformer/Generation.hs
The problem goes away when I comment everything below the
decode
function.I have observed this issue with ghc 8.10.4 and hls 1.0, ghc 8.10.5 and hls 1.2, and now ghc 9.0.1 and hls 1.3.
Your environment
Output of
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
:haskell-language-server version: 1.3.0.0 (GHC: 9.0.1) (PATH: /nix/store/wcygg534z7l88pkgapwnmafs9mz47da0-haskell-language-server-exe-haskell-language-server-1.3.0.0/bin/haskell-language-server) Tool versions found on the $PATH cabal: 3.4.0.0 stack: 2.7.3 ghc: 9.0.1
Which OS do you use:
MacOS
Which lsp-client do you use:
vscode
Describe your project (alternative: link to the project):
https://github.com/hasktorch/hasktorch/tree/generation-2
Contents of
hie.yaml
:https://github.com/hasktorch/hasktorch/blob/generation-2/hie.yaml
Steps to reproduce
Expected behaviour
HLS should not crash or become unresponsive.
Actual behaviour
HLS crashes or becomes unresponsive.
Include debug information
Execute in the root of your project the command
haskell-language-server --debug .
and paste the logs here:HLS processes all files and exits normally.
Paste the logs from the lsp-client, e.g. for VS Code
LSP logs:
The text was updated successfully, but these errors were encountered: