Closed fendor closed 4 months ago
When the session set up fails, then the HLS thread crashes and will not be restarted.
I added a catch to the session setup, logging the error. After the error is thrown, HLS appears to be completely stuck.
catch
Example trace:
2024-06-27T15:50:04.706392Z | Debug | stack setup --silent 2024-06-27T15:50:05.070647Z | Debug | stack exec ghc -- --numeric-version [Trace - 17:50:05] Received notification '$/progress'. 2024-06-27T15:50:05.070866Z | Debug | Session loading result: Right (ComponentOptions {componentOptions = ["-i","-odir=/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/.stack-work/odir","-hidir=/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/.stack-work/odir","-hide-all-packages","-XGHC2021","-i/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/explainable/.stack-work/dist/x86_64-linux/ghc-9.6.5/build/explainable-exe","-i/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/explainable/app","-i/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/explainable/.stack-work/dist/x86_64-linux/ghc-9.6.5/build/explainable-exe/autogen","-i/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/explainable/.stack-work/dist/x86_64-linux/ghc-9.6.5/build/global-autogen","-i/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/explainable/.stack-work/dist/x86_64-linux/ghc-9.6.5/build/explainable-exe/explainable-exe-tmp","-stubdir=/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/explainable/.stack-work/dist/x86_64-linux/ghc-9.6.5/build","-package-id=QuickCheck-2.14.3-7WdOShjYsRTQ5DwHd4Gtb","-package-id=aeson-2.1.2.1-F3hDGK91Wx42rTliAGkUq","-package-id=base-4.18.2.1","-package-id=boxes-0.1.5-C5KrYVvXsQG8cA3g3hv7uh","-package-id=bytestring-0.11.5.3","-package-id=containers-0.6.7","-package-id=directory-1.3.8.4","-package-id=effectful-2.3.0.0-3V3X0RsGjod7jCYr6Wti","-package=explainable-0.1.0.0","-package-id=fgl-5.8.2.0-85Qkt6u9x2z5NSStlZTxr6","-package-id=filepath-1.4.300.1","-package-id=graphviz-2999.20.2.0-64QWSEOt6dh36pYl7wtiek","-package-id=hspec-2.11.9-4wTKmuILwwUEq4fqjWEoZg","-package-id=lens-5.2.3-G0LWaXeEo0UDN0iZ5b4CcG","-package-id=megaparsec-9.5.0-D2uz1Hosetnt14WoHo7Ea","-package-id=mtl-2.3.1","-package-id=numeric-extras-0.1-LgQWj8Z8pmPKPk9V7di9SO","-package-id=openapi3-3.2.4-8OMi17vBjaf4LVrZUUMg5C","-package-id=optparse-applicative-0.18.1.0-KKw4zpvajYE9Msk9T1Ikpr","-package-id=parsec-3.1.16.1","-package-id=parser-combinators-1.3.0-20UTEUZ5CKDJdRu747ID48","-package-id=pcre-heavy-1.0.0.3-6TcStAgMWa5DIw1maQ5Z9t","-package-id=prettyprinter-1.7.1-60yVE7QePDs8FHIPsacPFF","-package-id=prettyprinter-interp-0.2.0.0-5T6TkajMYyiGGBwTvUfYk3","-package-id=quickcheck-instances-0.3.30-KikxF4MVt6S9929xX2tsLH","-package-id=scientific-0.3.7.0-7ih7NuxY8AT9Jmz8D0EZgy","-package-id=servant-0.20.1-6oNY4TzoYI63JyjY0sLHWq","-package-id=servant-openapi3-2.0.1.6-FQDfjqNkbplHlJNuW2u5gJ","-package-id=servant-server-0.20-DtT9lGedLuzJu9wRxFzqT4","-package-id=servant-swagger-ui-0.3.5.5.0.0-7dLcEYwWM2i53FUQ5BcZKg","-package-id=string-interpolate-0.3.3.0-FdcmmUSqZzY5RLaNHS2LG4","-package-id=text-2.0.2","-package-id=transformers-0.6.1.0","-package-id=unordered-containers-0.2.20-ED65WLJGTgHKKHANJYMwZr","-package-id=wai-3.2.4-6PqrRGq5uVCcx5GJE074k","-package-id=wai-logger-2.4.0-K2ThryFHdX15W72WGMUmgk","-package-id=warp-3.3.31-BQkvXyHwhQ02XfAxYTn4Y8","-Wall","-Wcompat","-Widentities","-Wincomplete-record-updates","-Wincomplete-uni-patterns","-Wmissing-export-lists","-Wmissing-home-modules","-Wpartial-fields","-Wredundant-constraints","-Wall","-rtsopts","-with-rtsopts=-N","-fwrite-ide-info","-optP-include","-optP/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/.stack-work/ghci/69ba514d/cabal_macros.h","-ghci-script=/home/hugin/.cache/stack/ghci-script/3484a1de/ghci-script","-package-db","/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/.stack-work/install/x86_64-linux/b436016af794c3fa6328af8976a3bc0bcf56a1156d8c4cc82a3d6f67ee396726/9.6.5/pkgdb","-package-db","/home/hugin/.stack/snapshots/x86_64-linux/b436016af794c3fa6328af8976a3bc0bcf56a1156d8c4cc82a3d6f67ee396726/9.6.5/pkgdb","-package-db","/home/hugin/.ghcup/ghc/9.6.5/lib/ghc-9.6.5/lib/package.conf.d"], componentRoot = "/home/hugin/Documents/haskell/cclaw/dsl/lib/haskell/explainable", componentDependencies = ["explainable/explainable.cabal","explainable/package.yaml","stack.yaml"]},"/home/hugin/.ghcup/ghc/9.6.5/lib/ghc-9.6.5/lib","9.6.5") 2024-06-27T15:50:05.083638Z | Info | Interface files cache directory: /home/hugin/.cache/ghcide/main-d8039823af9b65242e8d42ce90d5528ab12596c0-d8039823af9b65242e8d42ce90d5528ab12596c0 2024-06-27T15:50:05.090341Z | Info | Making new HscEnv. In-place unit ids: [ main-d8039823af9b65242e8d42ce90d5528ab12596c0 ] cannot satisfy -package explainable-0.1.0.0 (use -v for more information)
The error itself is a manifestation of https://github.com/commercialhaskell/stack/issues/5380, not relevant to this issue, though.
However, we should catch such errors and handle them gracefully.
We might be able to capture it and throw the error to the rule evaluation
When the session set up fails, then the HLS thread crashes and will not be restarted.
I added a
catch
to the session setup, logging the error. After the error is thrown, HLS appears to be completely stuck.Example trace:
The error itself is a manifestation of https://github.com/commercialhaskell/stack/issues/5380, not relevant to this issue, though.
However, we should catch such errors and handle them gracefully.