-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
Performance: adding an import
retriggers a long "Processing"
#4443
Comments
I've bisect our codebase and the problem appeared when upgrading to GHC 9.10 (same version of HLS in both cases). Do you know how I can evaluate if:
The log with |
import
retriggers a long "Processingimport
retriggers a long "Processing"
Generally, it can be rather tricky to identify changes in behaviour across GHC versions... Maybe the open telemetry support we have is useful, see https://haskell-language-server.readthedocs.io/en/stable/contributing/contributing.html#tracing. |
I ran into a similar problem when starting a new project, and I think this is caused by a mismatch in I have HLS 2.9.0.1, GHC 9.10.1, Stack 3.1.1, Cabal 3.12.1.0, all installed through GHCup. I have no |
As cabal and stack don't share any build caches, this is almost certainly a different issue. Please open another issue, and include the information obtained by following the steps here: https://github.com/haskell/vscode-haskell?tab=readme-ov-file#investigating-and-reporting-problems |
@alexmccord note that it seems different, but I also observed infinite "Processing" since moving to GHC 9.10, but I had never really be able to understand / track / reproduce it. Most of the time, I restart the lsp, and/or clean the different caches and I'm good again. Sometime I think I had just let HLS run for hours (got bored, decided to leave for a hike) and when back, it was done. So may not be a "lock", but something really long. Anyway, as @fendor said, maybe another (linked?) issue. |
I have also observed this. I wonder if the change to the imports is causing us to invalidate an excessive amount of state somehow? |
Do you confirm that it only happen with GHC 9.10? Or did you observed it with another version of GHC and perhaps there are two issues: the invalidation (all ghc versions?) and GHC 9.10 performance regression somewhere else? |
I've opened https://github.com/haskell/haskell-language-server/tree/repro_4443 which is a repro of this problem. The
{-# LANGUAGE TemplateHaskell #-}
module MyLib (i) where
import Control.Concurrent (threadDelay)
import Language.Haskell.TH.Syntax
-- | This code generates a super simple integer, but waits for 10s during
-- compilation
i = $(do
runIO (threadDelay 10000000)
[e|5|]) It uses The second module, module Lib2 where
import MyLib
import Data.Functor ()
blurk = 20 With suffisant warnings set ( Once HLS is fully loaded (after a minimum of This is perfectly reproducible here, with one gotcha (And I thought I was completly mad): I need to have both By the way, I'm using neovim. Next tasks:
|
Same problem with VScode. Here is a "short" video showing the issue. hls_invalidation-2024-12-31_22.49.55.mp4 |
(by the way, I'm using current HLS f09500b) |
I'm currently building with ghc 9.8 in order to confirm if ghc version is involved or not. (I'm starting to have doubt, I initially documented that the problem started to appear when we bumped ghc version to 9.10, but maybe because the problem seems to be only reproducible when other files are opened, maybe my bisect session on our codebase was "incorrect"). In the meantime, does this rings a bell to one of you? I've promised to one day take the time to dig in HLS code in more depth, but that's not a promise I'll validate on 2024 (well, I still have 1 hour left... ;) Happy new year when you'll read this message). A few questions:
|
The problem also happen with GHC 9.8 and the repro code I pushed. I will check on my huge / propriotary codebase that I did something wrong when tracking it, but that's really interesting, because that's a bug in HLS and not a bug in ghc. I'll try to bisect HLS. |
I'll stop the investigation on our proprietary codebase, this is not as reproducible as expected, so first let's investigate and understand the "simple" repro we have here, maybe the problem we have on our big codebase is complex and is the sum of multiples bugs. |
For the record, here is the current state of my bisect Step for the bisect:
I'll continue tomorrow. note: in all case, opening |
I've bisected to: 9effc56 is the first bad commit
Ping @wz1000, the comment
Is especially interesting in the current situation. |
I've read a bit the comments / discussion on #3232 which lead to this refactoring and a few additionnal informations: a) There are two algorithm for dependency detection, one requires to load ALL modules first, the other can do it on the fly. Depending on the size of the codebase and multiples details, one or the other can be more performant. |
Your environment
Which OS do you use? Linux / NixOS
Which version of GHC do you use and how did you install it? GHC
9.10.1
, installed using nix/nixpkgs.How is your project built (alternative: link to the project)? A custom build system based on nix.
Which LSP client (editor/plugin) do you use? Neovim builtin lsp
Which version of HLS do you use and how did you install it?
2.9.0.0
Have you configured HLS in any way (especially: a
hie.yaml
file)?My
hie.yaml
contains:And the nix target
haskell_hie_bios
lists all the required build flags used by GHC to build one monolithic packages composed of 1089 modules. It also contains the listing of the 1089 modules, eg:Steps to reproduce
I don't know how to reproduce that outside of our large codebase, but what do I observe:
--debug --log /path/to/a/file.log
main
function and no other module depends on that module).In the log.
import
section, I can add/remove symbols in the currently existing imported module, but if I add (or remove) animport
statment, it startsProcessing
for a long time. For example, after addingimport Data.Functor
on top of my file, I can seeProcessing
andIndexing
(and actually, a few, sometime 2 or 3Processing
) and for a few seconds, HLS is not reactive anymore. Here is the message in the log:(I'm surprised by the 3 lines of log. but note the
36s
.). Note that there may be another problem with my setup or with HLS because36s
is a really long time, but the original problem is that I'm wondering why it is "re-processing" everything.Expected behavior
Should not
Processing
for40s
when I had an import. I can understand that it may invalidate the build tree by adding animport
, but this file being at the End of the build hierarchy, no module depends on it, so it is surprising.Debug information
Sorry, I'm opening this issue without much details, in order to start tracking the problem. I'll try to investigate a bit more (especially, it looks like the issue is new at work, so I may be able to find which update triggered it.)
The text was updated successfully, but these errors were encountered: