-
-
Notifications
You must be signed in to change notification settings - Fork 369
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 has ridiculously high CPU/memory usage using typed holes #2315
Comments
Hi, thanks for the bug report, could you post a link to the project triggering that anomalous behaviour to try to reproduce? |
Unfortunately, I can’t share the code. Neither have I been able to find a reproducer project, though I have tried. If you want I can email you to set up a video call, if that will help at all. |
So you have not identificated what project charateristic trigger the ill behaviour... 😟 Another source of anomalous behaviour could be the use of template haskell, if it is related, loading modules without th and without dependant modules using it will take less memory. |
Alas, no, though I hope to try doing this more carefully when I get enough time.
Thanks for the tip! I’ll try this now.
I do use some Template Haskell, and in particular I recall that I recently added a Lucius quasiquoter to the relevant module. I tried removing it, but it seems to have had no effect. |
OK, so I tried disabling all extensions, with the following code in my (setq-default
lsp-haskell-brittany-on nil
lsp-haskell-eval-on nil
lsp-haskell-floskell-on nil
lsp-haskell-fourmolu-on nil
lsp-haskell-ghcide-on nil
lsp-haskell-hlint-on nil
lsp-haskell-importlens-on nil
lsp-haskell-modulename-on nil
lsp-haskell-ormolu-on nil
lsp-haskell-pragmas-on nil
lsp-haskell-retrie-on nil
lsp-haskell-stylish-haskell-on nil
lsp-haskell-tactic-on nil
) But it had no effect: HLS still reported extremely high memory usage. Also, I’ve found a series of actions which will reliably reproduce the problem for this particular module:
Curiously enough, CPU usage only increases on moving the cursor to the first error: even moving it to the first warning is not enough. It is perhaps also relevant that the error in question is a typed hole, the type of which is displayed at the bottom of the frame: |
In fact, some further experimenting convinces me that the problem is related to typed holes. When I alter it to EDIT: But that can’t be the whole story, for when I create a small test project with a typed hole, everything works correctly. And furthermore I’ve used typed holes many times in the past without running into this issue. |
Maybe the size of dependencies/imports of the module could be related, as hls/ghc will have to examine more modules to gather suggestions? |
Perhaps, but I doubt it: I added |
Maybe we are tweaking ghc options underneath... 🤔 Afaiu we have detected typed holes impact performance see
//cc @pepeiborra |
I doubt it’s related to Wingman at least, since I’ve still got plugins disabled. |
yeah, but wingman had to disable hole refinements when enabled by performance reasons Take a look to https://github.com/haskell/haskell-language-server/pull/2037/files, which is disabling the feature removing hardcoded ghc options modifications. |
Just to be sure, do you still think that typed holes are related? |
Well, I can’t know for sure, since I’ve only found this one module which triggers it, but I can’t think of very much else that could be the cause — it goes away when I change it to a variable name or |
Also note, |
Your environment
Which OS do you use: Windows
Which lsp-client do you use: Emacs
Describe your project: stack.yaml + *.cabal files
Contents of
hie.yaml
:Steps to reproduce
Open a file in
./gui/web/
and wait. (The bug doesn’t seem to occur for any other target of this project, nor for any other project.)Expected behaviour
HLS works as expected.
Actual behaviour
After HLS initialises, it rapidly climbs to >90% CPU usage and correspondingly high memory usage:
This invariably causes Emacs to freeze.
Include debug information
Debug output:
LSP logs:
The text was updated successfully, but these errors were encountered: