Skip to content

Segmentation fault opening a project in debian 9 using the precompiled binary in ci (debian 10) #2054

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

Closed
jneira opened this issue Jul 31, 2021 · 5 comments
Labels
type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@jneira
Copy link
Member

jneira commented Jul 31, 2021

  • From discod user mallory
  • os and ghc: linux kernel 4.4.0-21-generic and installed ghc with ghcup using the deb9 download
  • Output of calling hls in the cli
~/.config/Code/User/globalStorage/haskell.haskell/haskell-language-server-1.3.0-linux-9.0.1 --logfile=./log.txt

haskell-language-server version: 1.3.0.0 (GHC: 9.0.1) (PATH: /home/foo/.config/Code/User/globalStorage/haskell.haskell/haskell-language-server-1.3.0-linux-9.0.1) (GIT hash: e7c5e90b6df5dff2760d76169eddaea3bdd6a831)
 ghcide setup tester in /home/foo/Documents/git/haskell/project.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in /home/foo/Documents/git/haskell/project
Found 2 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  ()

Step 3/4: Initializing the IDE

Step 4/4: Type checking the files
Output from setting up the cradle Cradle {cradleRootDir = "/home/foo/Documents/git/haskell/project", cradleOptsProg = CradleAction: Cabal}
Output from setting up the cradle Cradle {cradleRootDir = "/home/foo/Documents/git/haskell/project", cradleOptsProg = CradleAction: Cabal}
> Build profile: -w ghc-9.0.1 -O1
> In order, the following will be built (use -v for more details):
>  - git-backup-0.1.0.0 (exe:git-backup) (first run)
> Preprocessing executable 'git-backup' for git-backup-0.1.0.0..
Output from setting up the cradle Cradle {cradleRootDir = "/home/foo/Documents/git/haskell/project", cradleOptsProg = CradleAction: Cabal}
Segmentation fault
  • lsp output
2021-07-31 12:45:26.767378645 [ThreadId 24] INFO hls:    Consulting the cradle for "Setup.hs"
2021-07-31 12:45:26.767525619 [ThreadId 24] WARNING hls:    No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for Setup.hs.
 Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
2021-07-31 12:45:26.775157013 [ThreadId 21] INFO hls:    File:     /home/foo/Documents/git/haskell/project/Setup.hs
Hidden:   no
Range:    1:1-2:1
Source:   cradle
Severity: DsError
Message: 
  �[0;91mMulti Cradle: No prefixes matched
  pwd: /home/foo/Documents/git/haskell/project
  filepath: /home/foo/Documents/git/haskell/project/Setup.hs
  prefixes:
  ("./Main.hs",Cabal {component = Just "project:exe:project"})�[0m
2021-07-31 12:45:26.775771921 [ThreadId 26] INFO hls:    Consulting the cradle for "Main.hs"
2021-07-31 12:45:26.775869639 [ThreadId 26] WARNING hls:    No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for Main.hs.
 Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
2021-07-31 12:45:27.391583164 [ThreadId 26] INFO hls:    Using interface files cache dir: /home/foo/.cache/ghcide/main-1e96f7f938b8e41aea62c1acec06786020a2cbc7
2021-07-31 12:45:27.391889268 [ThreadId 26] INFO hls:    Making new HscEnv[main]
2021-07-31 12:45:27.408326901 [ThreadId 53] INFO hls:    Consulting the cradle for "Setup.hs"
2021-07-31 12:45:27.408397278 [ThreadId 53] WARNING hls:    No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for Setup.hs.
 Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
  • User reports hls works fin in a new simple project and this one has template haskell which works with 8.10
@jneira jneira added ghc-9 type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Jul 31, 2021
@jneira
Copy link
Member Author

jneira commented Jul 31, 2021

It is reproduced with

  1. cabal init with cabal 3.4
  2. add aeson as dependency to build-depends in the cabal file
  3. open the project in vscode with code .

@jneira
Copy link
Member Author

jneira commented Jul 31, 2021

Cant reproduce in windows 10

PS D:\dev\ws\haskell\issues\init-aeson> haskell-language-server-9.0.1 --debug
haskell-language-server version: 1.3.0.0 (GHC: 9.0.1) (PATH: D:\ghcup\bin\haskell-language-server-9.0.1~1.3.0.exe) (GIT hash: e7c5e90b6df5dff2760d76169eddaea3bdd6a831)
 ghcide setup tester in D:\dev\ws\haskell\issues\init-aeson.
Report bugs at https://github.com/haskell/haskell-language-server/issues

Step 1/4: Finding files to test in D:\dev\ws\haskell\issues\init-aeson
Found 1 files

Step 2/4: Looking for hie.yaml files that control setup
Found 1 cradle
  ()

Step 3/4: Initializing the IDE
2021-07-31 23:30:19.9764514 [ThreadId 6] DEBUG hls:     Initializing exports map from hiedb
2021-07-31 23:30:19.9884797 [ThreadId 6] DEBUG hls:     Done initializing exports map from hiedb (0)

Step 4/4: Type checking the files
2021-07-31 23:30:19.9924512 [ThreadId 14] DEBUG hls:    hlint:getIdeas:file:NormalizedFilePath "D:\\dev\\ws\\haskell\\issues\\init-aeson\\app\\Main.hs"
2021-07-31 23:30:20.0044557 [ThreadId 20] INFO hls:     Consulting the cradle for "app\\Main.hs"
2021-07-31 23:30:20.0044557 [ThreadId 20] WARNING hls:  No [cradle](https://github.com/mpickering/hie-bios#hie-bios) found for app\Main.hs.
 Proceeding with [implicit cradle](https://hackage.haskell.org/package/implicit-hie).
You should ignore this message, unless you see a 'Multi Cradle: No prefixes matched' error.
Output from setting up the cradle Cradle {cradleRootDir = "D:\\dev\\ws\\haskell\\issues\\init-aeson", cradleOptsProg = CradleAction: Cabal}
> Resolving dependencies...
> Build profile: -w ghc-9.0.1 -O1
> In order, the following will be built (use -v for more details):
>  - init-aeson-0.1.0.0 (exe:init-aeson) (configuration changed)
> Configuring executable 'init-aeson' for init-aeson-0.1.0.0..
> Preprocessing executable 'init-aeson' for init-aeson-0.1.0.0..
2021-07-31 23:30:51.9843622 [ThreadId 20] DEBUG hls:    Session loading result: Right (ComponentOptions {componentOptions = ["-fbuilding-cabal-package","-O0","-outputdir","C:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\init-aeson\\init-aeson-tmp","-odir","C:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\init-aeson\\init-aeson-tmp","-hidir","C:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\init-aeson\\init-aeson-tmp","-stubdir","C:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\init-aeson\\init-aeson-tmp","-i","-iC:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\init-aeson\\init-aeson-tmp","-iapp","-iC:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\init-aeson\\autogen","-iC:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\global-autogen","-IC:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\init-aeson\\autogen","-IC:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\global-autogen","-IC:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\init-aeson\\init-aeson-tmp","-ID:\\ghcup\\msys64\\mingw64\\include","-optP-include","-optPC:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\build\\init-aeson\\autogen\\cabal_macros.h","-LD:\\ghcup\\msys64\\mingw64\\lib","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","D:\\cabal\\store\\ghc-9.0.1\\package.db","-package-db","C:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\packagedb\\ghc-9.0.1","-package-db","C:\\Users\\atrey\\AppData\\Local\\hie-bios\\dist-init-aeson-b54f2b7ec923db633668793dca25f794\\build\\x86_64-windows\\ghc-9.0.1\\init-aeson-0.1.0.0\\x\\init-aeson\\package.conf.inplace","-package-id","aeson-1.5.6.0-5102613fd88ee95ea58cb4d09daa0168dde373ed","-package-id","base-4.15.0.0","-XHaskell2010","app\\Main.hs","-hide-all-packages"], componentRoot = "D:\\dev\\ws\\haskell\\issues\\init-aeson", componentDependencies = ["init-aeson.cabal","cabal.project","cabal.project.local"]},"D:\\ghcup\\ghc\\9.0.1\\lib")
2021-07-31 23:30:52.1123631 [ThreadId 20] INFO hls:     Using interface files cache dir: C:\Users\atrey\AppData\Local\ghcide\main-eee8e92ef2cd3666a838369e3bef59762ffc1fc3
2021-07-31 23:30:52.1163712 [ThreadId 20] INFO hls:     Making new HscEnv[main]
2021-07-31 23:30:52.136371 [ThreadId 20] DEBUG hls:     New Component Cache HscEnvEq: (([],Just HscEnvEq 5),fromList [("cabal.project",Nothing),("cabal.project.local",Nothing),("init-aeson.cabal",Just 2021-07-31 21:04:58.1094771 UTC)])
2021-07-31 23:30:52.1403665 [ThreadId 20] DEBUG hls:    Known files updated: fromList [(TargetFile NormalizedFilePath "D:\\dev\\ws\\haskell\\issues\\init-aeson\\app\\Main.hs",fromList ["D:\\dev\\ws\\haskell\\issues\\init-aeson\\app\\Main.hs"])]
2021-07-31 23:30:52.1403665 [ThreadId 10] DEBUG hls:    Finishing build session(exception: AsyncCancelled)
2021-07-31 23:30:52.1403665 [ThreadId 20] DEBUG hls:    Restarting build session for keys [GhcSessionIO; ] (aborting the previous one took 0.00s)
2021-07-31 23:30:52.1443614 [ThreadId 42] DEBUG hls:    hlint:getIdeas:file:NormalizedFilePath "D:\\dev\\ws\\haskell\\issues\\init-aeson\\app\\Main.hs"
2021-07-31 23:30:54.0003671 [ThreadId 129] INFO hls:    finish: User TypeCheck (took 1.85s)
2021-07-31 23:30:54.0203649 [ThreadId 136] INFO hls:    finish: GetHie (took 0.02s)

2021-07-31 23:30:54.0203649 [ThreadId 137] INFO hls:    finish: GenerateCore (took 0.00s)
Completed (1 file worked, 0 files failed)

@anka-213
Copy link
Contributor

anka-213 commented Aug 2, 2021

I wonder if it's related to this change: #1649 (comment)

I never managed to figure out how, when and if initLoaderState is supposed to be used in ghc-9.0.

@jneira jneira changed the title Segmentation fault opening project with ghc-9.0.1 Segmentation fault opening project with ghc-9.0.1 in debian 9 Aug 3, 2021
@jneira
Copy link
Member Author

jneira commented Aug 3, 2021

As confirmed by the original reporter, the segfault was caused by using the precompiled hls binary (ubuntu-18.04/debian 10) in a machine with debian 9. The workaround has been built hls from source in the target machine.
Not sure if we can do much more in our end.

Maybe we could provide binaries for the different linux versions, but it would make the releases and the distribution more complex.

It is related with the problems in our ci when github bumped up the linux latest version to ubuntu-20.04/debian 11: #1723

@jneira jneira closed this as completed Aug 3, 2021
@jneira jneira removed the ghc-9 label Aug 3, 2021
@jneira jneira changed the title Segmentation fault opening project with ghc-9.0.1 in debian 9 Segmentation fault opening a project in debian 9 using the precompiled binary in ci (debian 10) Aug 3, 2021
@AxelUlmestig
Copy link

AxelUlmestig commented Jan 16, 2022

I had a similar problem on Ubuntu 20.04, I would get a segmentation fault from HLS when using Hasql-TH. Everything else worked fine.

Building HLS from source solved the issue.

To install HLS from source run:

./cabal-hls-install hls-8.10.7

in the cloned repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

3 participants