haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 211 forks source link

Temp object file issue (hie is unresponsive) #1520

Open fendor opened 4 years ago

fendor commented 4 years ago

Example error message: https://gist.github.com/fendor/35e7c50cc97d7b098c4bd683306b9a23 Crashes the ghc thread and renders most hie requests unresponsive. Sometimes you can see an endless progress message trying to compile a certain file.

Happens to me quite often when trying to compile the file: https://github.com/haskell/haskell-ide-engine/blob/master/src/Haskell/Ide/Engine/Version.hs while using a cabal cradle. Maybe related to the import of Paths_haskell_ide_engine? Invoking cabal clean or deleting dist-newstyle resolves the issue unreliably. However, the issue does also not happen reliably.

fendor commented 4 years ago

Stack Trace:

*** Exception (reporting due to +RTS -xc): (base:GHC.Exception.Type.SomeException), stack trace: 
  HscMain.hscCompileCoreExpr',
  called from HscMain.hscCompileCoreExpr,
  called from TcRnDriver.tc_rn_src_decls,
  called from TcRnDriver.tcRnSrcDecls,
  called from HscMain.ioMsgMaybe,
  called from HscMain.Typecheck-Rename,
  called from HscMain.tcRnModule',
  called from HscMain.hscTypecheck',
  called from HscMain.hscTypecheck,
  called from HscMain.hscFileFrontEnd,
  called from HscMain.genericHscFrontend',
  called from HscMain.genericHscFrontend,
  called from HscMain.hscIncrementalFrontend,
  called from HscMain.hscIncrementalCompile,
  called from HIE.Bios.Ghc.Api.initializeFlagsWithCradleWithMessage,
  called from Haskell.Ide.Engine.PluginUtils.gcatches,
  called from Language.Haskell.LSP.Core.withProgress,
  called from Control.Monad.Trans.Control.defaultLiftBaseWith,
  called from Control.Monad.Trans.Control.control,
  called from Haskell.Ide.Engine.PluginsIdeMonads.withProgress,
  called from Haskell.Ide.Engine.ModuleCache.runActionWithContext,
  called from RunTest.compileTarget,
  called from Haskell.Ide.Engine.PluginsIdeMonads.runIdeGhcM,
  called from RunTest.runServer,
  called from Main.run,
  called from Main.main

Updated error message:

/home/baldr/Documents/haskell/haskell-ide-engine/src/Haskell/Ide/Engine/Version.hs:24:8: fatal:
    cannot find object file ‘/run/user/1000/ghc25998_0/ghc_20.p_o’
    while linking an interpreted expression

@mpickering is this more helpful?

Full logs stderr.log(Incredibly huge stack trace, like 5MB)

mpickering commented 4 years ago

Hmm, I think that this error is probably something to do with enabling profiling and not the real cause of the error. Did you confirm that the file that GHC is looking for is actually created at some point?

mpickering commented 4 years ago

Does this only happen when the Paths_ module is needed by Template Haskell or can it be reproduced with other modules?

mpickering commented 4 years ago

I am wondering how the object file for the Paths_ gets generated in the first place because it's not a source file.

fendor commented 4 years ago

While there are ton of stacktraces, too, loading the file hie-plugin-api/Haskell/Ide/Engine/Cradle.hs succeeds. I will test if removing the dependency on Paths_ module fixes the problem.

dpvanbalen commented 4 years ago

I ran into the same issue, on windows with a stack project (Accelerate). Example error:

2020-01-21 14:49:10.6271858 [ThreadId 31] - Scheduler thread exited unexpectedly: loadObj "C:\\Users\\dpvan\\AppData\\Local\\Temp\\ghc9852_0\\ghc_81.o": failed

HIE worked on this project before, I now am not getting it to work again. Other projects work fine, haven't been able to isolate the issue yet. Cabal clean and stack clean don't solve the issue for me.

mudsam commented 4 years ago

Same issue here with a yesod project on Ubuntu in WSL2 under Windows 10.

2020-01-25 15:54:17.6998273 [ThreadId 8] - Found cradle: Cradle {cradleRootDir = "/home/mudsam/my-website", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
hie-8.6.5: loadObj: /tmp/ghc6732_0/ghc_16.o: file doesn't exist
hie-8.6.5: loadObj "/tmp/ghc6732_0/ghc_16.o": failed
fendor commented 4 years ago

@mudsam @dpvanbalen There should be a loading message in VSCode, or lsp-client of choice, does it get stuck on a specific Module? Can you reproduce it (with latest master), with the command hie --debug src/ where src/ is just directory of the component that fails to load? Are there more logs than just that? Is template Haskell happening in these projects? If yes, explicit import of Paths_* module and does it still happen if you remove usage of the Paths_* module?

skress commented 4 years ago

I initially reported #1207 and I still have the same problems with latest master. @fendor can you please explain the Paths_* thing a bit? I am a Haskell beginner, so I am not really sure what to do.

Nevertheless I have tried to minimize the problem. The problem that I had was during some TH code that should provide access to static files for a Yesod project. I have simply copied Yesod's code into a new project which you can find at https://github.com/skress/hie-test.

Running hie --debug src/Settings in that project results in this error:

Running HIE(hie)
  Version 1.0.0.0, Git revision 4fb5b32df61f95d295ca67043594674bbb5b1316 (3706 commits) x86_64 ghc-8.8.1
To run as a LSP server on stdio, provide the '--lsp' argument
Current directory:/Users/skress/tmp/hie-test

args:["--debug","src/Settings"]

Looking for project config cradle...

2020-01-26 11:38:42.418748 [ThreadId 4] - Cabal-Helper found these projects: ["ProjLocStackYaml {plStackYaml = \"/Users/skress/tmp/hie-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/skress/tmp/hie-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/skress/tmp/hie-test\"}"]
2020-01-26 11:38:42.419268 [ThreadId 4] - These projects have the build tools installed: ["ProjLocStackYaml {plStackYaml = \"/Users/skress/tmp/hie-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/skress/tmp/hie-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/skress/tmp/hie-test\"}"]
2020-01-26 11:38:42.419318 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/Users/skress/tmp/hie-test/stack.yaml"}
2020-01-26 11:38:42.419412 [ThreadId 4] - Cabal-Helper dirs: ["/Users/skress/tmp/hie-test","/Users/skress/tmp/hie-test/File.hs"]
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
2020-01-26 11:38:44.463813 [ThreadId 4] - Cabal-Helper cradle package: Package {pPackageName = "hie-test", pSourceDir = "/Users/skress/tmp/hie-test", pCabalFile = CabalFile "/Users/skress/tmp/hie-test/hie-test.cabal", pFlags = [], pUnits = Unit {uUnitId = UnitId "hie-test", uPackage = Package {pPackageName = "hie-test", pSourceDir = "/Users/skress/tmp/hie-test", pCabalFile = CabalFile "/Users/skress/tmp/hie-test/hie-test.cabal", pFlags = [], pUnits = ()}, uDistDir = DistDirLib "/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0", uImpl = UnitImplStack} :| []}
2020-01-26 11:38:44.464219 [ThreadId 4] - Cabal-Helper normalisedPackageLocation: /Users/skress/tmp/hie-test
2020-01-26 11:38:44.464264 [ThreadId 4] - Module "/Users/skress/tmp/hie-test/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/Users/skress/tmp/hie-test", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 11:38:44.464392 [ThreadId 4] - Executing Stack GHC with args: --numeric-version
2020-01-26 11:38:44.988792 [ThreadId 4] - GHC Output: "Just "8.8.1""
2020-01-26 11:38:44.988974 [ThreadId 4] - Executing Stack GHC with args: --print-libdir
2020-01-26 11:38:45.505797 [ThreadId 4] - GHC Output: "Just "/Users/skress/.stack/programs/x86_64-osx/ghc-8.8.1/lib/ghc-8.8.1""

###################################################

Cradle: Stack project
Project Ghc version: 8.8.1
Libdir: Just "/Users/skress/.stack/programs/x86_64-osx/ghc-8.8.1/lib/ghc-8.8.1"
Searching for Haskell source files...
Found 1 Haskell source files.

###################################################

Found the following files:

/Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs

Load them all now. This may take a very long time.

2020-01-26 11:38:45.510382 [ThreadId 4] - New cradle: /Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs
2020-01-26 11:38:45.512351 [ThreadId 4] - Cabal-Helper found these projects: ["ProjLocStackYaml {plStackYaml = \"/Users/skress/tmp/hie-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/skress/tmp/hie-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/skress/tmp/hie-test\"}"]
2020-01-26 11:38:45.512517 [ThreadId 4] - These projects have the build tools installed: ["ProjLocStackYaml {plStackYaml = \"/Users/skress/tmp/hie-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/skress/tmp/hie-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/skress/tmp/hie-test\"}"]
2020-01-26 11:38:45.512563 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/Users/skress/tmp/hie-test/stack.yaml"}
2020-01-26 11:38:45.512591 [ThreadId 4] - Cabal-Helper dirs: ["/Users/skress/tmp/hie-test","/Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs"]
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
2020-01-26 11:38:47.491649 [ThreadId 4] - Cabal-Helper cradle package: Package {pPackageName = "hie-test", pSourceDir = "/Users/skress/tmp/hie-test", pCabalFile = CabalFile "/Users/skress/tmp/hie-test/hie-test.cabal", pFlags = [], pUnits = Unit {uUnitId = UnitId "hie-test", uPackage = Package {pPackageName = "hie-test", pSourceDir = "/Users/skress/tmp/hie-test", pCabalFile = CabalFile "/Users/skress/tmp/hie-test/hie-test.cabal", pFlags = [], pUnits = ()}, uDistDir = DistDirLib "/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0", uImpl = UnitImplStack} :| []}
2020-01-26 11:38:47.492 [ThreadId 4] - Cabal-Helper normalisedPackageLocation: /Users/skress/tmp/hie-test
2020-01-26 11:38:47.49205 [ThreadId 4] - Module "/Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs" is loaded by Cradle: Cradle {cradleRootDir = "/Users/skress/tmp/hie-test", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 11:38:47.492088 [ThreadId 4] - Found cradle: Cradle {cradleRootDir = "/Users/skress/tmp/hie-test", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 11:38:47.492127 [ThreadId 4] - Relative Module FilePath: src/Settings/StaticFiles.hs
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
2020-01-26 11:38:48.273818 [ThreadId 4] - Unit Info: UnitInfo {uiUnitId = UnitId "hie-test", uiPackageId = ("hie-test",Version {versionBranch = [0,1,0,0], versionTags = []}), uiComponents = fromList [(ChLibName ChMainLibName,ChComponentInfo {ciComponentName = ChLibName ChMainLibName, ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-odir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-hidir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-stubdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-i","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-isrc","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen/cabal_macros.h","-this-unit-id","hie-test-0.1.0.0-2Urdi8kZ5SpCtc00rzHLAf","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/skress/.stack/snapshots/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-db","/Users/skress/tmp/hie-test/.stack-work/install/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-id","base-4.13.0.0","-package-id","base64-bytestring-1.0.0.3-INJAeiVIzci9sxb4eqQ1My","-package-id","bytestring-0.10.9.0","-package-id","conduit-1.3.1.2-29o3MuJMxNVItiWVHvq6Dm","-package-id","containers-0.6.2.1","-package-id","cryptonite-0.26-9WA8vUWGH8cKehVgoUWXlj","-package-id","cryptonite-conduit-0.2.2-168jMd2aHTaKOenRFbkD3T","-package-id","directory-1.3.3.2","-package-id","memory-0.15.0-K23t96K2U35Fc0yb51f17d","-package-id","template-haskell-2.15.0.0","-package-id","text-1.2.4.0","-package-id","transformers-0.5.6.2","-XHaskell2010"], ciSourceDirs = ["src"], ciEntrypoints = ChLibEntrypoint {chExposedModules = [ChModuleName {unChModuleName = "Lib"},ChModuleName {unChModuleName = "Settings.StaticFiles"}], chOtherModules = [ChModuleName {unChModuleName = "Paths_hie_test"}], chSignatures = []}}),(ChExeName "hie-test-exe",ChComponentInfo {ciComponentName = ChExeName "hie-test-exe", ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-odir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-hidir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-stubdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-i","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-iapp","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/autogen","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/autogen/cabal_macros.h","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/skress/.stack/snapshots/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-db","/Users/skress/tmp/hie-test/.stack-work/install/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-id","base-4.13.0.0","-package-id","base64-bytestring-1.0.0.3-INJAeiVIzci9sxb4eqQ1My","-package-id","bytestring-0.10.9.0","-package-id","conduit-1.3.1.2-29o3MuJMxNVItiWVHvq6Dm","-package-id","containers-0.6.2.1","-package-id","cryptonite-0.26-9WA8vUWGH8cKehVgoUWXlj","-package-id","cryptonite-conduit-0.2.2-168jMd2aHTaKOenRFbkD3T","-package-id","directory-1.3.3.2","-package-id","hie-test-0.1.0.0-2Urdi8kZ5SpCtc00rzHLAf","-package-id","memory-0.15.0-K23t96K2U35Fc0yb51f17d","-package-id","template-haskell-2.15.0.0","-package-id","text-1.2.4.0","-package-id","transformers-0.5.6.2","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N"], ciSourceDirs = ["app"], ciEntrypoints = ChExeEntrypoint {chMainIs = "Main.hs", chOtherModules = [ChModuleName {unChModuleName = "Paths_hie_test"}]}})], uiCompilerId = ("GHC",Version {versionBranch = [8,8,1], versionTags = []}), uiPackageFlags = [], uiConfigFlags = [], uiNonDefaultConfigFlags = [], uiModTimes = UnitModTimes {umtPkgYaml = Just ("/Users/skress/tmp/hie-test/package.yaml",1579448985), umtCabalFile = ("/Users/skress/tmp/hie-test/hie-test.cabal",1580034096), umtSetupConfig = Just ("/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/setup-config",1580035023)}}
2020-01-26 11:38:48.276103 [ThreadId 4] - Flags for "/Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs": ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-odir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-hidir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-stubdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-i","-i/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-i/Users/skress/tmp/hie-test/src","-i/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-i/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen/cabal_macros.h","-this-unit-id","hie-test-0.1.0.0-2Urdi8kZ5SpCtc00rzHLAf","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/skress/.stack/snapshots/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-db","/Users/skress/tmp/hie-test/.stack-work/install/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-id","base-4.13.0.0","-package-id","base64-bytestring-1.0.0.3-INJAeiVIzci9sxb4eqQ1My","-package-id","bytestring-0.10.9.0","-package-id","conduit-1.3.1.2-29o3MuJMxNVItiWVHvq6Dm","-package-id","containers-0.6.2.1","-package-id","cryptonite-0.26-9WA8vUWGH8cKehVgoUWXlj","-package-id","cryptonite-conduit-0.2.2-168jMd2aHTaKOenRFbkD3T","-package-id","directory-1.3.3.2","-package-id","memory-0.15.0-K23t96K2U35Fc0yb51f17d","-package-id","template-haskell-2.15.0.0","-package-id","text-1.2.4.0","-package-id","transformers-0.5.6.2","-XHaskell2010","Lib","Settings.StaticFiles","Paths_hie_test"]
2020-01-26 11:38:48.276565 [ThreadId 4] - Component Infos: ChComponentInfo {ciComponentName = ChLibName ChMainLibName, ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-odir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-hidir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-stubdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-i","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-isrc","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen/cabal_macros.h","-this-unit-id","hie-test-0.1.0.0-2Urdi8kZ5SpCtc00rzHLAf","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/skress/.stack/snapshots/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-db","/Users/skress/tmp/hie-test/.stack-work/install/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-id","base-4.13.0.0","-package-id","base64-bytestring-1.0.0.3-INJAeiVIzci9sxb4eqQ1My","-package-id","bytestring-0.10.9.0","-package-id","conduit-1.3.1.2-29o3MuJMxNVItiWVHvq6Dm","-package-id","containers-0.6.2.1","-package-id","cryptonite-0.26-9WA8vUWGH8cKehVgoUWXlj","-package-id","cryptonite-conduit-0.2.2-168jMd2aHTaKOenRFbkD3T","-package-id","directory-1.3.3.2","-package-id","memory-0.15.0-K23t96K2U35Fc0yb51f17d","-package-id","template-haskell-2.15.0.0","-package-id","text-1.2.4.0","-package-id","transformers-0.5.6.2","-XHaskell2010"], ciSourceDirs = ["src"], ciEntrypoints = ChLibEntrypoint {chExposedModules = [ChModuleName {unChModuleName = "Lib"},ChModuleName {unChModuleName = "Settings.StaticFiles"}], chOtherModules = [ChModuleName {unChModuleName = "Paths_hie_test"}], chSignatures = []}}
hie: loadObj: /private/var/folders/tj/8mwsk9sd6kb0b42k38t59_7r0000gn/T/ghc13444_0/ghc_3.o: file doesn't exist
hie: loadObj "/private/var/folders/tj/8mwsk9sd6kb0b42k38t59_7r0000gn/T/ghc13444_0/ghc_3.o": failed

Please take a look at https://github.com/skress/hie-test/blob/41f25a2f407db5ac10caad11d2abd245f68bbdda/src/Lib.hs#L39. The TH code that generates the list of files will also create hashes of the files. When I disable the creation of the hash code, i.e. simply change True to False in that linked line, then HIE works.

Just as any fyi: It seems that I sometimes have to rm -rf .stack-work ~/.cache/hie-bios and running hie --debug src/Settings multiple times. At first hie crashes with a segmentation fault, later I get the loadObj ... failed error.

Here is a log which ends in a seg fault:

Running HIE(hie)
  Version 1.0.0.0, Git revision 4fb5b32df61f95d295ca67043594674bbb5b1316 (3706 commits) x86_64 ghc-8.8.1
To run as a LSP server on stdio, provide the '--lsp' argument
Current directory:/Users/skress/tmp/hie-test

args:["--debug","src/Settings"]

Looking for project config cradle...

2020-01-26 11:53:05.222996 [ThreadId 4] - Cabal-Helper found these projects: ["ProjLocStackYaml {plStackYaml = \"/Users/skress/tmp/hie-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/skress/tmp/hie-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/skress/tmp/hie-test\"}"]
2020-01-26 11:53:05.223571 [ThreadId 4] - These projects have the build tools installed: ["ProjLocStackYaml {plStackYaml = \"/Users/skress/tmp/hie-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/skress/tmp/hie-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/skress/tmp/hie-test\"}"]
2020-01-26 11:53:05.223626 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/Users/skress/tmp/hie-test/stack.yaml"}
2020-01-26 11:53:05.22366 [ThreadId 4] - Cabal-Helper dirs: ["/Users/skress/tmp/hie-test","/Users/skress/tmp/hie-test/File.hs"]
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
2020-01-26 11:53:07.428824 [ThreadId 4] - Cabal-Helper cradle package: Package {pPackageName = "hie-test", pSourceDir = "/Users/skress/tmp/hie-test", pCabalFile = CabalFile "/Users/skress/tmp/hie-test/hie-test.cabal", pFlags = [], pUnits = Unit {uUnitId = UnitId "hie-test", uPackage = Package {pPackageName = "hie-test", pSourceDir = "/Users/skress/tmp/hie-test", pCabalFile = CabalFile "/Users/skress/tmp/hie-test/hie-test.cabal", pFlags = [], pUnits = ()}, uDistDir = DistDirLib "/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0", uImpl = UnitImplStack} :| []}
2020-01-26 11:53:07.429277 [ThreadId 4] - Cabal-Helper normalisedPackageLocation: /Users/skress/tmp/hie-test
2020-01-26 11:53:07.42933 [ThreadId 4] - Module "/Users/skress/tmp/hie-test/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/Users/skress/tmp/hie-test", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 11:53:07.429464 [ThreadId 4] - Executing Stack GHC with args: --numeric-version
2020-01-26 11:53:07.922405 [ThreadId 4] - GHC Output: "Just "8.8.1""
2020-01-26 11:53:07.922599 [ThreadId 4] - Executing Stack GHC with args: --print-libdir
2020-01-26 11:53:08.491497 [ThreadId 4] - GHC Output: "Just "/Users/skress/.stack/programs/x86_64-osx/ghc-8.8.1/lib/ghc-8.8.1""

###################################################

Cradle: Stack project
Project Ghc version: 8.8.1
Libdir: Just "/Users/skress/.stack/programs/x86_64-osx/ghc-8.8.1/lib/ghc-8.8.1"
Searching for Haskell source files...
Found 1 Haskell source files.

###################################################

Found the following files:

/Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs

Load them all now. This may take a very long time.

2020-01-26 11:53:08.495246 [ThreadId 4] - New cradle: /Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs
2020-01-26 11:53:08.496785 [ThreadId 4] - Cabal-Helper found these projects: ["ProjLocStackYaml {plStackYaml = \"/Users/skress/tmp/hie-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/skress/tmp/hie-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/skress/tmp/hie-test\"}"]
2020-01-26 11:53:08.496937 [ThreadId 4] - These projects have the build tools installed: ["ProjLocStackYaml {plStackYaml = \"/Users/skress/tmp/hie-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/skress/tmp/hie-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/skress/tmp/hie-test\"}"]
2020-01-26 11:53:08.497023 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/Users/skress/tmp/hie-test/stack.yaml"}
2020-01-26 11:53:08.497079 [ThreadId 4] - Cabal-Helper dirs: ["/Users/skress/tmp/hie-test","/Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs"]
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
2020-01-26 11:53:10.601752 [ThreadId 4] - Cabal-Helper cradle package: Package {pPackageName = "hie-test", pSourceDir = "/Users/skress/tmp/hie-test", pCabalFile = CabalFile "/Users/skress/tmp/hie-test/hie-test.cabal", pFlags = [], pUnits = Unit {uUnitId = UnitId "hie-test", uPackage = Package {pPackageName = "hie-test", pSourceDir = "/Users/skress/tmp/hie-test", pCabalFile = CabalFile "/Users/skress/tmp/hie-test/hie-test.cabal", pFlags = [], pUnits = ()}, uDistDir = DistDirLib "/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0", uImpl = UnitImplStack} :| []}
2020-01-26 11:53:10.60201 [ThreadId 4] - Cabal-Helper normalisedPackageLocation: /Users/skress/tmp/hie-test
2020-01-26 11:53:10.602055 [ThreadId 4] - Module "/Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs" is loaded by Cradle: Cradle {cradleRootDir = "/Users/skress/tmp/hie-test", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 11:53:10.602093 [ThreadId 4] - Found cradle: Cradle {cradleRootDir = "/Users/skress/tmp/hie-test", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 11:53:10.602136 [ThreadId 4] - Relative Module FilePath: src/Settings/StaticFiles.hs
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
2020-01-26 11:53:11.437862 [ThreadId 4] - Unit Info: UnitInfo {uiUnitId = UnitId "hie-test", uiPackageId = ("hie-test",Version {versionBranch = [0,1,0,0], versionTags = []}), uiComponents = fromList [(ChLibName ChMainLibName,ChComponentInfo {ciComponentName = ChLibName ChMainLibName, ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-odir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-hidir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-stubdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-i","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-isrc","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen/cabal_macros.h","-this-unit-id","hie-test-0.1.0.0-2Urdi8kZ5SpCtc00rzHLAf","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/skress/.stack/snapshots/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-db","/Users/skress/tmp/hie-test/.stack-work/install/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-id","base-4.13.0.0","-package-id","base64-bytestring-1.0.0.3-INJAeiVIzci9sxb4eqQ1My","-package-id","bytestring-0.10.9.0","-package-id","conduit-1.3.1.2-29o3MuJMxNVItiWVHvq6Dm","-package-id","containers-0.6.2.1","-package-id","cryptonite-0.26-9WA8vUWGH8cKehVgoUWXlj","-package-id","cryptonite-conduit-0.2.2-168jMd2aHTaKOenRFbkD3T","-package-id","directory-1.3.3.2","-package-id","memory-0.15.0-K23t96K2U35Fc0yb51f17d","-package-id","template-haskell-2.15.0.0","-package-id","text-1.2.4.0","-package-id","transformers-0.5.6.2","-XHaskell2010"], ciSourceDirs = ["src"], ciEntrypoints = ChLibEntrypoint {chExposedModules = [ChModuleName {unChModuleName = "Lib"},ChModuleName {unChModuleName = "Settings.StaticFiles"}], chOtherModules = [ChModuleName {unChModuleName = "Paths_hie_test"}], chSignatures = []}}),(ChExeName "hie-test-exe",ChComponentInfo {ciComponentName = ChExeName "hie-test-exe", ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-odir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-hidir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-stubdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-i","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-iapp","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/autogen","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/hie-test-exe-tmp","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/hie-test-exe/autogen/cabal_macros.h","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/skress/.stack/snapshots/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-db","/Users/skress/tmp/hie-test/.stack-work/install/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-id","base-4.13.0.0","-package-id","base64-bytestring-1.0.0.3-INJAeiVIzci9sxb4eqQ1My","-package-id","bytestring-0.10.9.0","-package-id","conduit-1.3.1.2-29o3MuJMxNVItiWVHvq6Dm","-package-id","containers-0.6.2.1","-package-id","cryptonite-0.26-9WA8vUWGH8cKehVgoUWXlj","-package-id","cryptonite-conduit-0.2.2-168jMd2aHTaKOenRFbkD3T","-package-id","directory-1.3.3.2","-package-id","hie-test-0.1.0.0-2Urdi8kZ5SpCtc00rzHLAf","-package-id","memory-0.15.0-K23t96K2U35Fc0yb51f17d","-package-id","template-haskell-2.15.0.0","-package-id","text-1.2.4.0","-package-id","transformers-0.5.6.2","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N"], ciSourceDirs = ["app"], ciEntrypoints = ChExeEntrypoint {chMainIs = "Main.hs", chOtherModules = [ChModuleName {unChModuleName = "Paths_hie_test"}]}})], uiCompilerId = ("GHC",Version {versionBranch = [8,8,1], versionTags = []}), uiPackageFlags = [], uiConfigFlags = [], uiNonDefaultConfigFlags = [], uiModTimes = UnitModTimes {umtPkgYaml = Just ("/Users/skress/tmp/hie-test/package.yaml",1579448985), umtCabalFile = ("/Users/skress/tmp/hie-test/hie-test.cabal",1580034096), umtSetupConfig = Just ("/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/setup-config",1580035977)}}
2020-01-26 11:53:11.440156 [ThreadId 4] - Flags for "/Users/skress/tmp/hie-test/src/Settings/StaticFiles.hs": ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-odir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-hidir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-stubdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-i","-i/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-i/Users/skress/tmp/hie-test/src","-i/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-i/Users/skress/tmp/hie-test/.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen/cabal_macros.h","-this-unit-id","hie-test-0.1.0.0-2Urdi8kZ5SpCtc00rzHLAf","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/skress/.stack/snapshots/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-db","/Users/skress/tmp/hie-test/.stack-work/install/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-id","base-4.13.0.0","-package-id","base64-bytestring-1.0.0.3-INJAeiVIzci9sxb4eqQ1My","-package-id","bytestring-0.10.9.0","-package-id","conduit-1.3.1.2-29o3MuJMxNVItiWVHvq6Dm","-package-id","containers-0.6.2.1","-package-id","cryptonite-0.26-9WA8vUWGH8cKehVgoUWXlj","-package-id","cryptonite-conduit-0.2.2-168jMd2aHTaKOenRFbkD3T","-package-id","directory-1.3.3.2","-package-id","memory-0.15.0-K23t96K2U35Fc0yb51f17d","-package-id","template-haskell-2.15.0.0","-package-id","text-1.2.4.0","-package-id","transformers-0.5.6.2","-XHaskell2010","Lib","Settings.StaticFiles","Paths_hie_test"]
2020-01-26 11:53:11.440646 [ThreadId 4] - Component Infos: ChComponentInfo {ciComponentName = ChLibName ChMainLibName, ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-odir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-hidir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-stubdir",".stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-i","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-isrc","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-i.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-3.0.0.0/build/autogen/cabal_macros.h","-this-unit-id","hie-test-0.1.0.0-2Urdi8kZ5SpCtc00rzHLAf","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/skress/.stack/snapshots/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-db","/Users/skress/tmp/hie-test/.stack-work/install/x86_64-osx/5a46273b1be3c6c2e7772deb194640e10f18a09311f9cfa7aed68949cab0713e/8.8.1/pkgdb","-package-id","base-4.13.0.0","-package-id","base64-bytestring-1.0.0.3-INJAeiVIzci9sxb4eqQ1My","-package-id","bytestring-0.10.9.0","-package-id","conduit-1.3.1.2-29o3MuJMxNVItiWVHvq6Dm","-package-id","containers-0.6.2.1","-package-id","cryptonite-0.26-9WA8vUWGH8cKehVgoUWXlj","-package-id","cryptonite-conduit-0.2.2-168jMd2aHTaKOenRFbkD3T","-package-id","directory-1.3.3.2","-package-id","memory-0.15.0-K23t96K2U35Fc0yb51f17d","-package-id","template-haskell-2.15.0.0","-package-id","text-1.2.4.0","-package-id","transformers-0.5.6.2","-XHaskell2010"], ciSourceDirs = ["src"], ciEntrypoints = ChLibEntrypoint {chExposedModules = [ChModuleName {unChModuleName = "Lib"},ChModuleName {unChModuleName = "Settings.StaticFiles"}], chOtherModules = [ChModuleName {unChModuleName = "Paths_hie_test"}], chSignatures = []}}
[1]    15115 segmentation fault  ~/.local/bin/hie --debug src/Settings
dpvanbalen commented 4 years ago

By using a GHC version (8.4.4) that I had not compiled Accelerate with before, I managed to get HIE work again (compiled hie for 8.4.4, changed the stack.yaml for Accelerate to 8.4.4, stack build in Accelerate, then start up VSCode).

After restarting VSCode (no other changes needed), I get the same error again: hie is trying to open a temporary file that apparently got deleted as soon as I closed VSCode:

2020-01-26 17:59:16.3489591 [ThreadId 3] - run entered for hie-wrapper(hie-wrapper.exe) Version 1.0.0.0, Git revision cf025df05ae50ff042f55290376151abae8c0cbd (dirty) (3593 commits) x86_64 ghc-8.4.4
2020-01-26 17:59:16.3509541 [ThreadId 3] - Current directory:c:\Users\dpvan\Documents\cs\thesis\accelerate
2020-01-26 17:59:16.3519513 [ThreadId 3] - Operating system:mingw32
2020-01-26 17:59:16.3519513 [ThreadId 3] - args:["--lsp"]
2020-01-26 17:59:16.3649176 [ThreadId 3] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "c:\\Users\\dpvan\\Documents\\cs\\thesis\\accelerate\\stack.yaml"}
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
2020-01-26 17:59:18.6145691 [ThreadId 3] - Module "c:\Users\dpvan\Documents\cs\thesis\accelerate\File.hs" is loaded by Cradle: Cradle {cradleRootDir = "C:\\Users\\dpvan\\Documents\\cs\\thesis\\accelerate", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 17:59:18.6145691 [ThreadId 3] - Cradle directory:C:\Users\dpvan\Documents\cs\thesis\accelerate
2020-01-26 17:59:18.6145691 [ThreadId 3] - Use Stack GHC
2020-01-26 17:59:19.0177579 [ThreadId 3] - Project GHC version:8.4.4
2020-01-26 17:59:19.0187561 [ThreadId 3] - hie exe candidates :["hie-8.4.4.exe","hie-8.4.exe","hie.exe"]
2020-01-26 17:59:19.0187561 [ThreadId 3] - found hie exe at:C:\Users\dpvan\AppData\Roaming\local\bin\hie-8.4.4.exe
2020-01-26 17:59:19.0197532 [ThreadId 3] - args:["--lsp"]
2020-01-26 17:59:19.0197532 [ThreadId 3] - launching ....

2020-01-26 17:59:19.4088949 [ThreadId 3] - Run entered for HIE(hie-8.4.4.exe) Version 1.0.0.0, Git revision cf025df05ae50ff042f55290376151abae8c0cbd (dirty) (3593 commits) x86_64 ghc-8.4.4
2020-01-26 17:59:19.4088949 [ThreadId 3] - Operating as a LSP server on stdio
2020-01-26 17:59:19.4088949 [ThreadId 3] - Current directory:c:\Users\dpvan\Documents\cs\thesis\accelerate
2020-01-26 17:59:19.4088949 [ThreadId 3] - Operating system:mingw32
2020-01-26 17:59:19.4088949 [ThreadId 3] - args:["--lsp"]
2020-01-26 17:59:19.4592353 [ThreadId 3] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "c:\\Users\\dpvan\\Documents\\cs\\thesis\\accelerate\\stack.yaml"}
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
2020-01-26 17:59:21.3942142 [ThreadId 3] - Module "c:\Users\dpvan\Documents\cs\thesis\accelerate\File.hs" is loaded by Cradle: Cradle {cradleRootDir = "C:\\Users\\dpvan\\Documents\\cs\\thesis\\accelerate", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 17:59:21.3952118 [ThreadId 3] - Use Stack GHC
2020-01-26 17:59:21.8176622 [ThreadId 32] - Use Stack GHC
Using hie version: Version 1.0.0.0, Git revision cf025df05ae50ff042f55290376151abae8c0cbd (dirty) (3593 commits) x86_64 ghc-8.4.4
2020-01-26 17:59:22.267379 [ThreadId 38] - New cradle: C:\Users\dpvan\Documents\cs\thesis\accelerate\src\Data\Array\Accelerate\Array\Sugar.hs
2020-01-26 17:59:22.2723254 [ThreadId 38] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "C:\\Users\\dpvan\\Documents\\cs\\thesis\\accelerate\\stack.yaml"}
Using hoogle db at: C:\Users\dpvan\AppData\Roaming\hoogle\default-haskell-5.0.17.hoo
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
2020-01-26 17:59:24.0356683 [ThreadId 38] - Module "C:\Users\dpvan\Documents\cs\thesis\accelerate\src\Data\Array\Accelerate\Array\Sugar.hs" is loaded by Cradle: Cradle {cradleRootDir = "C:\\Users\\dpvan\\Documents\\cs\\thesis\\accelerate", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 17:59:24.0356683 [ThreadId 38] - Found cradle: Cradle {cradleRootDir = "C:\\Users\\dpvan\\Documents\\cs\\thesis\\accelerate", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
stty: 'standard input': Inappropriate ioctl for device
2020-01-26 17:59:44.0883651 [ThreadId 32] - Scheduler thread exited unexpectedly: loadObj "C:\\Users\\dpvan\\AppData\\Local\\Temp\\ghc8372_0\\ghc_113.o": failed

I didn't manage to get other log files using hie --debug src/ and don't know what Paths_* is. The module hie gets stuck on depends on where I request things, but is probably always a module with TH (a lot of modules in Accelerate have TH). It often gets stuck on https://github.com/AccelerateHS/accelerate/blob/master/src/Data/Array/Accelerate/Trafo/Base.hs.

fendor commented 4 years ago

So, I think this issue is related to Template Haskell. Will need more investigation.

mudsam commented 4 years ago

To add to @skress excellent report. Yes, TemplateHaskell is being used.

I get two different errors with hie depending on if I've done stack build or not.

Without stack build having been run before hie gets stuck in an endless loop that ends with:

2020-01-26 10:13:37.3653398 [ThreadId 4] - Ghc error on cradle initialisation: "`gcc' failed in phase `C pre-processor'. (Exit code: 1)"

With stack build having been run before hie --debug fails with the temp object error:

$ hie --debug src
Running HIE(hie)
  Version 1.0.0.0, Git revision 4fb5b32df61f95d295ca67043594674bbb5b1316 (dirty) (3706 commits) x86_64 ghc-8.6.5
To run as a LSP server on stdio, provide the '--lsp' argument
Current directory:/home/mudsam/my-website

args:["--debug","src"]

Looking for project config cradle...

2020-01-26 10:15:35.9579413 [ThreadId 4] - Cabal-Helper found these projects: ["ProjLocStackYaml {plStackYaml = \"/home/mudsam/my-website/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/home/mudsam/my-website\"}","ProjLocV1Dir {plProjectDirV1 = \"/home/mudsam/my-website\"}"]
2020-01-26 10:15:35.9870776 [ThreadId 4] - These projects have the build tools installed: ["ProjLocStackYaml {plStackYaml = \"/home/mudsam/my-website/stack.yaml\"}"]
2020-01-26 10:15:35.9874875 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/mudsam/my-website/stack.yaml"}
2020-01-26 10:15:35.987876 [ThreadId 4] - Cabal-Helper dirs: ["/home/mudsam/my-website","/home/mudsam/my-website/File.hs"]
2020-01-26 10:15:36.9794634 [ThreadId 4] - Cabal-Helper cradle package: Package {pPackageName = "my-website", pSourceDir = "/home/mudsam/my-website", pCabalFile = CabalFile "/home/mudsam/my-website/my-website.cabal", pFlags = [], pUnits = Unit {uUnitId = UnitId "my-website", uPackage = Package {pPackageName = "my-website", pSourceDir = "/home/mudsam/my-website", pCabalFile = CabalFile "/home/mudsam/my-website/my-website.cabal", pFlags = [], pUnits = ()}, uDistDir = DistDirLib "/home/mudsam/my-website/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1", uImpl = UnitImplStack} :| []}
2020-01-26 10:15:36.9797148 [ThreadId 4] - Cabal-Helper normalisedPackageLocation: /home/mudsam/my-website
2020-01-26 10:15:36.9797742 [ThreadId 4] - Module "/home/mudsam/my-website/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/mudsam/my-website", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 10:15:36.9798937 [ThreadId 4] - Executing Stack GHC with args: --numeric-version
2020-01-26 10:15:37.188096 [ThreadId 4] - GHC Output: "Just "8.6.5""
2020-01-26 10:15:37.1884994 [ThreadId 4] - Executing Stack GHC with args: --print-libdir
2020-01-26 10:15:37.398047 [ThreadId 4] - GHC Output: "Just "/home/mudsam/.stack/programs/x86_64-linux/ghc-8.6.5/lib/ghc-8.6.5""

###################################################

Cradle: Stack project
Project Ghc version: 8.6.5
Libdir: Just "/home/mudsam/.stack/programs/x86_64-linux/ghc-8.6.5/lib/ghc-8.6.5"
Searching for Haskell source files...
Found 11 Haskell source files.

###################################################

Found the following files:

/home/mudsam/my-website/src/Foundation.hs
/home/mudsam/my-website/src/Application.hs
/home/mudsam/my-website/src/Import/NoFoundation.hs
/home/mudsam/my-website/src/Model.hs
/home/mudsam/my-website/src/Settings.hs
/home/mudsam/my-website/src/Handler/Profile.hs
/home/mudsam/my-website/src/Handler/Comment.hs
/home/mudsam/my-website/src/Handler/Common.hs
/home/mudsam/my-website/src/Handler/Home.hs
/home/mudsam/my-website/src/Import.hs
/home/mudsam/my-website/src/Settings/StaticFiles.hs

Load them all now. This may take a very long time.

2020-01-26 10:15:37.4014371 [ThreadId 4] - New cradle: /home/mudsam/my-website/src/Foundation.hs
2020-01-26 10:15:37.4023507 [ThreadId 4] - Cabal-Helper found these projects: ["ProjLocStackYaml {plStackYaml = \"/home/mudsam/my-website/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/home/mudsam/my-website\"}","ProjLocV1Dir {plProjectDirV1 = \"/home/mudsam/my-website\"}"]
2020-01-26 10:15:37.4174201 [ThreadId 4] - These projects have the build tools installed: ["ProjLocStackYaml {plStackYaml = \"/home/mudsam/my-website/stack.yaml\"}"]
2020-01-26 10:15:37.4175534 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/mudsam/my-website/stack.yaml"}
2020-01-26 10:15:37.4175986 [ThreadId 4] - Cabal-Helper dirs: ["/home/mudsam/my-website","/home/mudsam/my-website/src/Foundation.hs"]
2020-01-26 10:15:38.3921871 [ThreadId 4] - Cabal-Helper cradle package: Package {pPackageName = "my-website", pSourceDir = "/home/mudsam/my-website", pCabalFile = CabalFile "/home/mudsam/my-website/my-website.cabal", pFlags = [], pUnits = Unit {uUnitId = UnitId "my-website", uPackage = Package {pPackageName = "my-website", pSourceDir = "/home/mudsam/my-website", pCabalFile = CabalFile "/home/mudsam/my-website/my-website.cabal", pFlags = [], pUnits = ()}, uDistDir = DistDirLib "/home/mudsam/my-website/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1", uImpl = UnitImplStack} :| []}
2020-01-26 10:15:38.392568 [ThreadId 4] - Cabal-Helper normalisedPackageLocation: /home/mudsam/my-website
2020-01-26 10:15:38.392691 [ThreadId 4] - Module "/home/mudsam/my-website/src/Foundation.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/mudsam/my-website", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 10:15:38.3927914 [ThreadId 4] - Found cradle: Cradle {cradleRootDir = "/home/mudsam/my-website", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-26 10:15:38.3929227 [ThreadId 4] - Relative Module FilePath: src/Foundation.hs
2020-01-26 10:15:38.8110594 [ThreadId 4] - Unit Info: UnitInfo {uiUnitId = UnitId "my-website", uiPackageId = ("my-website",Version {versionBranch = [0,0,0], versionTags = []}), uiComponents = fromList [(ChLibName ChMainLibName,ChComponentInfo {ciComponentName = ChLibName ChMainLibName, ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-odir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-hidir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-stubdir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-i","-i.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-isrc","-i.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen","-i.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen/cabal_macros.h","-this-unit-id","my-website-0.0.0-ESee9hC3z10L7Sbg2iDEGh","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/mudsam/.stack/snapshots/x86_64-linux/7a9d1757e5e9eeb08202b26983c40833f5422774155c2815c37130635f49f0a2/8.6.5/pkgdb","-package-db","/home/mudsam/my-website/.stack-work/install/x86_64-linux/7a9d1757e5e9eeb08202b26983c40833f5422774155c2815c37130635f49f0a2/8.6.5/pkgdb","-package-id","aeson-1.4.6.0-CVJg8x8CwYyHRDrbccmlL3","-package-id","base-4.12.0.0","-package-id","bytestring-0.10.8.2","-package-id","case-insensitive-1.2.0.11-LNzmAWfaV4DDuYZvHeB9eK","-package-id","classy-prelude-1.5.0-2teupJ293G2G1AmNEKyTbm","-package-id","classy-prelude-conduit-1.5.0-KJCTiPcddDO4UeWbr51HKP","-package-id","classy-prelude-yesod-1.5.0-7OzD9Dp9Kgm9vGHfBi2kQS","-package-id","conduit-1.3.1.2-DakavT2TCqZ76l13uDnxF0","-package-id","containers-0.6.0.1","-package-id","data-default-0.7.1.1-COovZVyOTYqEavTGLlfqy8","-package-id","directory-1.3.3.0","-package-id","fast-logger-2.4.17-DpntV4m5nh5JaoWiJvQ295","-package-id","file-embed-0.0.11.1-1DkjC7VmQhQFLvxtpUIE3o","-package-id","foreign-store-0.2-FCKu23zJ1MhKEqdHalRzFz","-package-id","hjsmin-0.2.0.4-DFnKwxv3gObA5IWaWPtKfK","-package-id","http-client-tls-0.3.5.3-BtNnjZ7QmBQ9NmJP1ZZUvN","-package-id","http-conduit-2.3.7.3-89mETXV1VQvFwFylH9RcG1","-package-id","monad-control-1.0.2.3-At5xRpwF2S6HGPjjUhSXZF","-package-id","monad-logger-0.3.31-GvR0My7gCOIInZi7bTAnhJ","-package-id","persistent-2.9.2-FWVmanOI8vA8mNELbuAWHc","-package-id","persistent-sqlite-2.9.3-HQ0fAv3uSGpBDDY1qL67u6","-package-id","persistent-template-2.6.0-4V2tlRN6WG5LRw3A1Y8KD1","-package-id","safe-0.3.18-LtdH37oJsulDSBmeOJDMc3","-package-id","shakespeare-2.0.23-Gdv1eOP4BXTBNtVrWAp7YP","-package-id","template-haskell-2.14.0.0","-package-id","text-1.2.3.1","-package-id","time-1.8.0.2","-package-id","unordered-containers-0.2.10.0-LgoTL3wbBEY5bZIDJiyxW4","-package-id","vector-0.12.0.3-LfvlcMFJAcY18uD1Y2O5Ig","-package-id","wai-3.2.2.1-KnYIgMkchi2FbKMcqdbpAI","-package-id","wai-extra-3.0.28-Cc82BU7XEZ0L1rrBlfMhCR","-package-id","wai-logger-2.3.5-8l8S87bWwAM4iz4Rnkiwhl","-package-id","warp-3.3.5-FUhqE0VFEAR210qq7ZQ2bO","-package-id","yaml-0.11.2.0-B7NKbGWktZx2YAyfJsrFyw","-package-id","yesod-1.6.0-GcVDKJFzZ6g2ix5wHhfUIu","-package-id","yesod-auth-1.6.8-Cv7AqyLh8Jt2bbfd9zsA0b","-package-id","yesod-core-1.6.17-Ia58cz6VLaYHQXmnGEgwef","-package-id","yesod-form-1.6.7-76MzeetPJZ626PZGRTLiz7","-package-id","yesod-static-1.6.0.1-GUbyPWhVdvlIoC7aEBEpcz","-XHaskell2010","-Wall","-fwarn-tabs","-O2"], ciSourceDirs = ["src"], ciEntrypoints = ChLibEntrypoint {chExposedModules = [ChModuleName {unChModuleName = "Application"},ChModuleName {unChModuleName = "Foundation"},ChModuleName {unChModuleName = "Handler.Comment"},ChModuleName {unChModuleName = "Handler.Common"},ChModuleName {unChModuleName = "Handler.Home"},ChModuleName {unChModuleName = "Handler.Profile"},ChModuleName {unChModuleName = "Import"},ChModuleName {unChModuleName = "Import.NoFoundation"},ChModuleName {unChModuleName = "Model"},ChModuleName {unChModuleName = "Settings"},ChModuleName {unChModuleName = "Settings.StaticFiles"}], chOtherModules = [ChModuleName {unChModuleName = "Paths_my_website"}], chSignatures = []}}),(ChExeName "my-website",ChComponentInfo {ciComponentName = ChExeName "my-website", ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/my-website/my-website-tmp","-odir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/my-website/my-website-tmp","-hidir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/my-website/my-website-tmp","-stubdir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/my-website/my-website-tmp","-i","-i.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/my-website/my-website-tmp","-iapp","-i.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/my-website/autogen","-i.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/my-website/autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/my-website/my-website-tmp","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/my-website/autogen/cabal_macros.h","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/mudsam/.stack/snapshots/x86_64-linux/7a9d1757e5e9eeb08202b26983c40833f5422774155c2815c37130635f49f0a2/8.6.5/pkgdb","-package-db","/home/mudsam/my-website/.stack-work/install/x86_64-linux/7a9d1757e5e9eeb08202b26983c40833f5422774155c2815c37130635f49f0a2/8.6.5/pkgdb","-package-id","aeson-1.4.6.0-CVJg8x8CwYyHRDrbccmlL3","-package-id","base-4.12.0.0","-package-id","bytestring-0.10.8.2","-package-id","case-insensitive-1.2.0.11-LNzmAWfaV4DDuYZvHeB9eK","-package-id","classy-prelude-1.5.0-2teupJ293G2G1AmNEKyTbm","-package-id","classy-prelude-conduit-1.5.0-KJCTiPcddDO4UeWbr51HKP","-package-id","classy-prelude-yesod-1.5.0-7OzD9Dp9Kgm9vGHfBi2kQS","-package-id","conduit-1.3.1.2-DakavT2TCqZ76l13uDnxF0","-package-id","containers-0.6.0.1","-package-id","data-default-0.7.1.1-COovZVyOTYqEavTGLlfqy8","-package-id","directory-1.3.3.0","-package-id","fast-logger-2.4.17-DpntV4m5nh5JaoWiJvQ295","-package-id","file-embed-0.0.11.1-1DkjC7VmQhQFLvxtpUIE3o","-package-id","foreign-store-0.2-FCKu23zJ1MhKEqdHalRzFz","-package-id","hjsmin-0.2.0.4-DFnKwxv3gObA5IWaWPtKfK","-package-id","http-client-tls-0.3.5.3-BtNnjZ7QmBQ9NmJP1ZZUvN","-package-id","http-conduit-2.3.7.3-89mETXV1VQvFwFylH9RcG1","-package-id","monad-control-1.0.2.3-At5xRpwF2S6HGPjjUhSXZF","-package-id","monad-logger-0.3.31-GvR0My7gCOIInZi7bTAnhJ","-package-id","my-website-0.0.0-ESee9hC3z10L7Sbg2iDEGh","-package-id","persistent-2.9.2-FWVmanOI8vA8mNELbuAWHc","-package-id","persistent-sqlite-2.9.3-HQ0fAv3uSGpBDDY1qL67u6","-package-id","persistent-template-2.6.0-4V2tlRN6WG5LRw3A1Y8KD1","-package-id","safe-0.3.18-LtdH37oJsulDSBmeOJDMc3","-package-id","shakespeare-2.0.23-Gdv1eOP4BXTBNtVrWAp7YP","-package-id","template-haskell-2.14.0.0","-package-id","text-1.2.3.1","-package-id","time-1.8.0.2","-package-id","unordered-containers-0.2.10.0-LgoTL3wbBEY5bZIDJiyxW4","-package-id","vector-0.12.0.3-LfvlcMFJAcY18uD1Y2O5Ig","-package-id","wai-3.2.2.1-KnYIgMkchi2FbKMcqdbpAI","-package-id","wai-extra-3.0.28-Cc82BU7XEZ0L1rrBlfMhCR","-package-id","wai-logger-2.3.5-8l8S87bWwAM4iz4Rnkiwhl","-package-id","warp-3.3.5-FUhqE0VFEAR210qq7ZQ2bO","-package-id","yaml-0.11.2.0-B7NKbGWktZx2YAyfJsrFyw","-package-id","yesod-1.6.0-GcVDKJFzZ6g2ix5wHhfUIu","-package-id","yesod-auth-1.6.8-Cv7AqyLh8Jt2bbfd9zsA0b","-package-id","yesod-core-1.6.17-Ia58cz6VLaYHQXmnGEgwef","-package-id","yesod-form-1.6.7-76MzeetPJZ626PZGRTLiz7","-package-id","yesod-static-1.6.0.1-GUbyPWhVdvlIoC7aEBEpcz","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N"], ciSourceDirs = ["app"], ciEntrypoints = ChExeEntrypoint {chMainIs = "main.hs", chOtherModules = [ChModuleName {unChModuleName = "DevelMain"},ChModuleName {unChModuleName = "Paths_my_website"}]}})], uiCompilerId = ("GHC",Version {versionBranch = [8,6,5], versionTags = []}), uiPackageFlags = [("dev",False),("library-only",False)], uiConfigFlags = [("dev",False),("library-only",False)], uiNonDefaultConfigFlags = [], uiModTimes = UnitModTimes {umtPkgYaml = Just ("/home/mudsam/my-website/package.yaml",1579369262), umtCabalFile = ("/home/mudsam/my-website/my-website.cabal",1579369262), umtSetupConfig = Just ("/home/mudsam/my-website/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/setup-config",1580058918)}}
2020-01-26 10:15:38.8116906 [ThreadId 4] - Flags for "/home/mudsam/my-website/src/Foundation.hs": ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-odir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-hidir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-stubdir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-i","-i/home/mudsam/my-website/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-i/home/mudsam/my-website/src","-i/home/mudsam/my-website/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen","-i/home/mudsam/my-website/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen/cabal_macros.h","-this-unit-id","my-website-0.0.0-ESee9hC3z10L7Sbg2iDEGh","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/mudsam/.stack/snapshots/x86_64-linux/7a9d1757e5e9eeb08202b26983c40833f5422774155c2815c37130635f49f0a2/8.6.5/pkgdb","-package-db","/home/mudsam/my-website/.stack-work/install/x86_64-linux/7a9d1757e5e9eeb08202b26983c40833f5422774155c2815c37130635f49f0a2/8.6.5/pkgdb","-package-id","aeson-1.4.6.0-CVJg8x8CwYyHRDrbccmlL3","-package-id","base-4.12.0.0","-package-id","bytestring-0.10.8.2","-package-id","case-insensitive-1.2.0.11-LNzmAWfaV4DDuYZvHeB9eK","-package-id","classy-prelude-1.5.0-2teupJ293G2G1AmNEKyTbm","-package-id","classy-prelude-conduit-1.5.0-KJCTiPcddDO4UeWbr51HKP","-package-id","classy-prelude-yesod-1.5.0-7OzD9Dp9Kgm9vGHfBi2kQS","-package-id","conduit-1.3.1.2-DakavT2TCqZ76l13uDnxF0","-package-id","containers-0.6.0.1","-package-id","data-default-0.7.1.1-COovZVyOTYqEavTGLlfqy8","-package-id","directory-1.3.3.0","-package-id","fast-logger-2.4.17-DpntV4m5nh5JaoWiJvQ295","-package-id","file-embed-0.0.11.1-1DkjC7VmQhQFLvxtpUIE3o","-package-id","foreign-store-0.2-FCKu23zJ1MhKEqdHalRzFz","-package-id","hjsmin-0.2.0.4-DFnKwxv3gObA5IWaWPtKfK","-package-id","http-client-tls-0.3.5.3-BtNnjZ7QmBQ9NmJP1ZZUvN","-package-id","http-conduit-2.3.7.3-89mETXV1VQvFwFylH9RcG1","-package-id","monad-control-1.0.2.3-At5xRpwF2S6HGPjjUhSXZF","-package-id","monad-logger-0.3.31-GvR0My7gCOIInZi7bTAnhJ","-package-id","persistent-2.9.2-FWVmanOI8vA8mNELbuAWHc","-package-id","persistent-sqlite-2.9.3-HQ0fAv3uSGpBDDY1qL67u6","-package-id","persistent-template-2.6.0-4V2tlRN6WG5LRw3A1Y8KD1","-package-id","safe-0.3.18-LtdH37oJsulDSBmeOJDMc3","-package-id","shakespeare-2.0.23-Gdv1eOP4BXTBNtVrWAp7YP","-package-id","template-haskell-2.14.0.0","-package-id","text-1.2.3.1","-package-id","time-1.8.0.2","-package-id","unordered-containers-0.2.10.0-LgoTL3wbBEY5bZIDJiyxW4","-package-id","vector-0.12.0.3-LfvlcMFJAcY18uD1Y2O5Ig","-package-id","wai-3.2.2.1-KnYIgMkchi2FbKMcqdbpAI","-package-id","wai-extra-3.0.28-Cc82BU7XEZ0L1rrBlfMhCR","-package-id","wai-logger-2.3.5-8l8S87bWwAM4iz4Rnkiwhl","-package-id","warp-3.3.5-FUhqE0VFEAR210qq7ZQ2bO","-package-id","yaml-0.11.2.0-B7NKbGWktZx2YAyfJsrFyw","-package-id","yesod-1.6.0-GcVDKJFzZ6g2ix5wHhfUIu","-package-id","yesod-auth-1.6.8-Cv7AqyLh8Jt2bbfd9zsA0b","-package-id","yesod-core-1.6.17-Ia58cz6VLaYHQXmnGEgwef","-package-id","yesod-form-1.6.7-76MzeetPJZ626PZGRTLiz7","-package-id","yesod-static-1.6.0.1-GUbyPWhVdvlIoC7aEBEpcz","-XHaskell2010","-Wall","-fwarn-tabs","-O2","Application","Foundation","Handler.Comment","Handler.Common","Handler.Home","Handler.Profile","Import","Import.NoFoundation","Model","Settings","Settings.StaticFiles","Paths_my_website"]
2020-01-26 10:15:38.8121544 [ThreadId 4] - Component Infos: ChComponentInfo {ciComponentName = ChLibName ChMainLibName, ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-odir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-hidir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-stubdir",".stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-i","-i.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-isrc","-i.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen","-i.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/autogen/cabal_macros.h","-this-unit-id","my-website-0.0.0-ESee9hC3z10L7Sbg2iDEGh","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/home/mudsam/.stack/snapshots/x86_64-linux/7a9d1757e5e9eeb08202b26983c40833f5422774155c2815c37130635f49f0a2/8.6.5/pkgdb","-package-db","/home/mudsam/my-website/.stack-work/install/x86_64-linux/7a9d1757e5e9eeb08202b26983c40833f5422774155c2815c37130635f49f0a2/8.6.5/pkgdb","-package-id","aeson-1.4.6.0-CVJg8x8CwYyHRDrbccmlL3","-package-id","base-4.12.0.0","-package-id","bytestring-0.10.8.2","-package-id","case-insensitive-1.2.0.11-LNzmAWfaV4DDuYZvHeB9eK","-package-id","classy-prelude-1.5.0-2teupJ293G2G1AmNEKyTbm","-package-id","classy-prelude-conduit-1.5.0-KJCTiPcddDO4UeWbr51HKP","-package-id","classy-prelude-yesod-1.5.0-7OzD9Dp9Kgm9vGHfBi2kQS","-package-id","conduit-1.3.1.2-DakavT2TCqZ76l13uDnxF0","-package-id","containers-0.6.0.1","-package-id","data-default-0.7.1.1-COovZVyOTYqEavTGLlfqy8","-package-id","directory-1.3.3.0","-package-id","fast-logger-2.4.17-DpntV4m5nh5JaoWiJvQ295","-package-id","file-embed-0.0.11.1-1DkjC7VmQhQFLvxtpUIE3o","-package-id","foreign-store-0.2-FCKu23zJ1MhKEqdHalRzFz","-package-id","hjsmin-0.2.0.4-DFnKwxv3gObA5IWaWPtKfK","-package-id","http-client-tls-0.3.5.3-BtNnjZ7QmBQ9NmJP1ZZUvN","-package-id","http-conduit-2.3.7.3-89mETXV1VQvFwFylH9RcG1","-package-id","monad-control-1.0.2.3-At5xRpwF2S6HGPjjUhSXZF","-package-id","monad-logger-0.3.31-GvR0My7gCOIInZi7bTAnhJ","-package-id","persistent-2.9.2-FWVmanOI8vA8mNELbuAWHc","-package-id","persistent-sqlite-2.9.3-HQ0fAv3uSGpBDDY1qL67u6","-package-id","persistent-template-2.6.0-4V2tlRN6WG5LRw3A1Y8KD1","-package-id","safe-0.3.18-LtdH37oJsulDSBmeOJDMc3","-package-id","shakespeare-2.0.23-Gdv1eOP4BXTBNtVrWAp7YP","-package-id","template-haskell-2.14.0.0","-package-id","text-1.2.3.1","-package-id","time-1.8.0.2","-package-id","unordered-containers-0.2.10.0-LgoTL3wbBEY5bZIDJiyxW4","-package-id","vector-0.12.0.3-LfvlcMFJAcY18uD1Y2O5Ig","-package-id","wai-3.2.2.1-KnYIgMkchi2FbKMcqdbpAI","-package-id","wai-extra-3.0.28-Cc82BU7XEZ0L1rrBlfMhCR","-package-id","wai-logger-2.3.5-8l8S87bWwAM4iz4Rnkiwhl","-package-id","warp-3.3.5-FUhqE0VFEAR210qq7ZQ2bO","-package-id","yaml-0.11.2.0-B7NKbGWktZx2YAyfJsrFyw","-package-id","yesod-1.6.0-GcVDKJFzZ6g2ix5wHhfUIu","-package-id","yesod-auth-1.6.8-Cv7AqyLh8Jt2bbfd9zsA0b","-package-id","yesod-core-1.6.17-Ia58cz6VLaYHQXmnGEgwef","-package-id","yesod-form-1.6.7-76MzeetPJZ626PZGRTLiz7","-package-id","yesod-static-1.6.0.1-GUbyPWhVdvlIoC7aEBEpcz","-XHaskell2010","-Wall","-fwarn-tabs","-O2"], ciSourceDirs = ["src"], ciEntrypoints = ChLibEntrypoint {chExposedModules = [ChModuleName {unChModuleName = "Application"},ChModuleName {unChModuleName = "Foundation"},ChModuleName {unChModuleName = "Handler.Comment"},ChModuleName {unChModuleName = "Handler.Common"},ChModuleName {unChModuleName = "Handler.Home"},ChModuleName {unChModuleName = "Handler.Profile"},ChModuleName {unChModuleName = "Import"},ChModuleName {unChModuleName = "Import.NoFoundation"},ChModuleName {unChModuleName = "Model"},ChModuleName {unChModuleName = "Settings"},ChModuleName {unChModuleName = "Settings.StaticFiles"}], chOtherModules = [ChModuleName {unChModuleName = "Paths_my_website"}], chSignatures = []}}
hie: loadObj: /tmp/ghc31670_0/ghc_16.o: file doesn't exist
hie: loadObj "/tmp/ghc31670_0/ghc_16.o": failed
maksbotan commented 4 years ago

I made a simple repository with reproducing example: https://github.com/maksbotan/hie-th-repro It the one I used in #1480 report.

Open src/Exp.hs and you should be able to see that HIE fails. If you comment line 13 and uncomment line 15 in src/TH.hs and restart HIE, it works. Which means that not every TemplateHaskell is broken, but the problem is more subtle.

Hope this helps your investigation.

fendor commented 4 years ago

It is very subtle, on your example, it works for me with cabal and stack. However, I get messages like: 2020-01-26 21:03:14.499238735 [ThreadId 97] - Source error on cradle initialisation: module ‘Paths_hie_th_repro’ cannot be found locally Which hints on another bug, if you use package.yaml, it automatically writes the

  other-modules:
      Paths_hie_th_repro

which hie seems to dislike

maksbotan commented 4 years ago

Are you sure it works for you? Did you try to get, for example, hover on some name in Exp.hs? If so, what else can I check? Since I'm completely sure it doesn't work for me. And does with another line uncommented.

BTW, I use macOS, if that matters. I can try to check on Linux tomorrow...

fendor commented 4 years ago

I am sure that it is working, I tried changing code, hover etc... You don't need to check anything, I know that this is an issue on linux, I initially reported this issue. It is just not easy to reproduce. Once it happens, it happens constantly, and sometimes it suddenly stops to be an issue. Then you cant reproduce it at all, and currently, I can reproduce it at all :/

fendor commented 4 years ago

Ironically, I can reproduce it now on the Haskell IDE Engine Code base, stuck on Version.hs. This is a huge example though.

fendor commented 4 years ago

It might be a race. When I was compiling stuff while trying to reproduce the bug, it didnt happen. The moment I stopped compiling (e.g. stopped maxing out my cpu), the issue arose instantly.

fendor commented 4 years ago

@maksbotan Can you execute, on your example project: hie --debug src/ and link the logs?

maksbotan commented 4 years ago

@fendor well, that command fails for me:

$ hie --debug src/
Invalid argument `src/'

Usage: hie [--version] [--help] [--numeric-version] [--compiler] [-d|--debug]
           [-l|--logfile LOGFILE] [--lsp] [-r|--project-root PROJECTROOT]
           ([--bios-verbose] | [--vomit]) [-c|--capture CAPTUREFILE] [--example]

My hie version (92ac896029a5ba5f740ebca168533c83848548c6):

$ hie --version
Version 1.0.0.0, Git revision 92ac896029a5ba5f740ebca168533c83848548c6 (dirty) (3589 commits) x86_64 ghc-8.6.3

Here's relevant part from log produced by --debug --vomit and running from vim:

2020-01-27 11:15:50.597388 [ThreadId 34] - Cabal-Helper found these projects: ["ProjLocStackYaml {plStackYaml = \"/Users/maksbotan/temp/hie-th-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/maksbotan/temp/hie-th-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/maksbotan/temp/hie-th-test\"}"]
2020-01-27 11:15:50.597632 [ThreadId 34] - These projects have the build tools installed: ["ProjLocStackYaml {plStackYaml = \"/Users/maksbotan/temp/hie-th-test/stack.yaml\"}","ProjLocV2Dir {plProjectDirV2 = \"/Users/maksbotan/temp/hie-th-test\"}","ProjLocV1Dir {plProjectDirV1 = \"/Users/maksbotan/temp/hie-th-test\"}"]
2020-01-27 11:15:50.59771 [ThreadId 5] - <--2--{"jsonrpc":"2.0","params":{"type":4,"message":"Using hoogle db at: /Users/maksbotan/.hoogle/default-haskell-5.0.17.hoo"},"method":"window/logMessage"}
2020-01-27 11:15:50.597748 [ThreadId 34] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/Users/maksbotan/temp/hie-th-test/stack.yaml"}
2020-01-27 11:15:50.597821 [ThreadId 34] - Cabal-Helper dirs: ["/Users/maksbotan/temp/hie-th-test","/Users/maksbotan/temp/hie-th-test/src/TH.hs"]
2020-01-27 11:15:51.809721 [ThreadId 34] - Cabal-Helper cradle package: Package {pPackageName = "hie-th-repro", pSourceDir = "/Users/maksbotan/temp/hie-th-test", pCabalFile = CabalFile "/Users/maksbotan/temp/hie-th-test/hie-th-repro.cabal", pFlags = [], pUnits = Unit {uUnitId = UnitId "hie-th-repro", uPackage = Package {pPackageName = "hie-th-repro", pSourceDir = "/Users/maksbotan/temp/hie-th-test", pCabalFile = CabalFile "/Users/maksbotan/temp/hie-th-test/hie-th-repro.cabal", pFlags = [], pUnits = ()}, uDistDir = DistDirLib "/Users/maksbotan/temp/hie-th-test/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1", uImpl = UnitImplStack} :| []}
2020-01-27 11:15:51.819303 [ThreadId 34] - Cabal-Helper normalisedPackageLocation: /Users/maksbotan/temp/hie-th-test
2020-01-27 11:15:51.819401 [ThreadId 34] - Module "/Users/maksbotan/temp/hie-th-test/src/TH.hs" is loaded by Cradle: Cradle {cradleRootDir = "/Users/maksbotan/temp/hie-th-test", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-27 11:15:51.819456 [ThreadId 34] - Found cradle: Cradle {cradleRootDir = "/Users/maksbotan/temp/hie-th-test", cradleOptsProg = CradleAction: Cabal-Helper-Stack}
2020-01-27 11:15:51.819502 [ThreadId 34] - Relative Module FilePath: src/TH.hs
2020-01-27 11:15:52.290698 [ThreadId 34] - Unit Info: UnitInfo {uiUnitId = UnitId "hie-th-repro", uiPackageId = ("hie-th-repro",Version {versionBranch = [0,1,0,0], versionTags = []}), uiComponents = fromList [(ChLibName ChMainLibName,ChComponentInfo {ciComponentName = ChLibName ChMainLibName, ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-odir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-hidir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-stubdir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-i","-i.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-isrc","-i.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen","-i.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen/cabal_macros.h","-this-unit-id","hie-th-repro-0.1.0.0-LxoPAIoOT0QJOzrvhyNNfu","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/maksbotan/.stack/snapshots/x86_64-osx/d1fc697e1e399d6299381a304e938b5708345e6c10b074dd87b3ecc5d6f11874/8.6.3/pkgdb","-package-db","/Users/maksbotan/temp/hie-th-test/.stack-work/install/x86_64-osx/d1fc697e1e399d6299381a304e938b5708345e6c10b074dd87b3ecc5d6f11874/8.6.3/pkgdb","-package-id","aeson-1.4.2.0-JRlZKD1FkrO2eJjy3cMEtP","-package-id","base-4.12.0.0","-package-id","bytestring-0.10.8.2","-package-id","lens-4.17-EALdarGCXihHZl8pEd1LaE","-package-id","lens-aeson-1.0.2-5EPfiZcWi1gASsBjwiW1aw","-package-id","template-haskell-2.14.0.0","-package-id","text-1.2.3.1","-package-id","yaml-0.11.0.0-50hP8h5vbYrLXemYINEsf8","-XHaskell2010","-XOverloadedStrings"], ciSourceDirs = ["src"], ciEntrypoints = ChLibEntrypoint {chExposedModules = [ChModuleName {unChModuleName = "Exp"},ChModuleName {unChModuleName = "TH"}], chOtherModules = [ChModuleName {unChModuleName = "Paths_hie_th_repro"}], chSignatures = []}})], uiCompilerId = ("GHC",Version {versionBranch = [8,6,3], versionTags = []}), uiPackageFlags = [], uiConfigFlags = [], uiNonDefaultConfigFlags = [], uiModTimes = UnitModTimes {umtPkgYaml = Just ("/Users/maksbotan/temp/hie-th-test/package.yaml",1580065712), umtCabalFile = ("/Users/maksbotan/temp/hie-th-test/hie-th-repro.cabal",1580065714), umtSetupConfig = Just ("/Users/maksbotan/temp/hie-th-test/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/setup-config",1580065986)}}
2020-01-27 11:15:52.290888 [ThreadId 34] - Flags for "/Users/maksbotan/temp/hie-th-test/src/TH.hs": ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-odir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-hidir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-stubdir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-i","-i/Users/maksbotan/temp/hie-th-test/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-i/Users/maksbotan/temp/hie-th-test/src","-i/Users/maksbotan/temp/hie-th-test/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen","-i/Users/maksbotan/temp/hie-th-test/.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen/cabal_macros.h","-this-unit-id","hie-th-repro-0.1.0.0-LxoPAIoOT0QJOzrvhyNNfu","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/maksbotan/.stack/snapshots/x86_64-osx/d1fc697e1e399d6299381a304e938b5708345e6c10b074dd87b3ecc5d6f11874/8.6.3/pkgdb","-package-db","/Users/maksbotan/temp/hie-th-test/.stack-work/install/x86_64-osx/d1fc697e1e399d6299381a304e938b5708345e6c10b074dd87b3ecc5d6f11874/8.6.3/pkgdb","-package-id","aeson-1.4.2.0-JRlZKD1FkrO2eJjy3cMEtP","-package-id","base-4.12.0.0","-package-id","bytestring-0.10.8.2","-package-id","lens-4.17-EALdarGCXihHZl8pEd1LaE","-package-id","lens-aeson-1.0.2-5EPfiZcWi1gASsBjwiW1aw","-package-id","template-haskell-2.14.0.0","-package-id","text-1.2.3.1","-package-id","yaml-0.11.0.0-50hP8h5vbYrLXemYINEsf8","-XHaskell2010","-XOverloadedStrings","Exp","TH","Paths_hie_th_repro"]
2020-01-27 11:15:52.290996 [ThreadId 34] - Component Infos: ChComponentInfo {ciComponentName = ChLibName ChMainLibName, ciGhcOptions = ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-odir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-hidir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-stubdir",".stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-i","-i.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-isrc","-i.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen","-i.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/global-autogen","-I.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-2.4.0.1/build/autogen/cabal_macros.h","-this-unit-id","hie-th-repro-0.1.0.0-LxoPAIoOT0QJOzrvhyNNfu","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/Users/maksbotan/.stack/snapshots/x86_64-osx/d1fc697e1e399d6299381a304e938b5708345e6c10b074dd87b3ecc5d6f11874/8.6.3/pkgdb","-package-db","/Users/maksbotan/temp/hie-th-test/.stack-work/install/x86_64-osx/d1fc697e1e399d6299381a304e938b5708345e6c10b074dd87b3ecc5d6f11874/8.6.3/pkgdb","-package-id","aeson-1.4.2.0-JRlZKD1FkrO2eJjy3cMEtP","-package-id","base-4.12.0.0","-package-id","bytestring-0.10.8.2","-package-id","lens-4.17-EALdarGCXihHZl8pEd1LaE","-package-id","lens-aeson-1.0.2-5EPfiZcWi1gASsBjwiW1aw","-package-id","template-haskell-2.14.0.0","-package-id","text-1.2.3.1","-package-id","yaml-0.11.0.0-50hP8h5vbYrLXemYINEsf8","-XHaskell2010","-XOverloadedStrings"], ciSourceDirs = ["src"], ciEntrypoints = ChLibEntrypoint {chExposedModules = [ChModuleName {unChModuleName = "Exp"},ChModuleName {unChModuleName = "TH"}], chOtherModules = [ChModuleName {unChModuleName = "Paths_hie_th_repro"}], chSignatures = []}}
2020-01-27 11:15:52.916022 [ThreadId 28] - Scheduler thread exited unexpectedly: loadObj "/private/var/folders/xm/wymzs8212vd2z4w239yz0kxr0000gn/T/ghc41614_0/ghc_4.o": failed
maksbotan commented 4 years ago

Well, I tried the same project on Linux and it seems that it works:

2020-01-27 20:30:43.554603985 [ThreadId 36] - Modules in the cradle: ["/home/maks/temp/hie-th-repro/src/Exp.hs","/home/maks/temp/hie-th-repro/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/autogen/Paths_hie_th_repro.hs","/home/maks/temp/hie-th-repro/src/TH.hs"]
2020-01-27 20:30:43.554794452 [ThreadId 36] - Cradle set succesfully
2020-01-27 20:30:43.555133633 [ThreadId 36] - haskell-lsp:persistFileVFS: Writing virtual file: uri = NormalizedUri "file:///home/maks/temp/hie-th-repro/src/Exp.hs", virtual file = "/tmp/haskell-lsp20344/Exp.hs-00000-2500205673677564293.hs"
2020-01-27 20:30:43.589943585 [ThreadId 36] - ghcDispatcher: top of loop
2020-01-27 20:30:43.590014685 [ThreadId 36] - ghcDispatcher:got request 1 with id: Nothing
2020-01-27 20:30:43.590040042 [ThreadId 36] - ghcDispatcher:Processing request as version matches
2020-01-27 20:30:43.590830414 [ThreadId 36] - Reusing cradle
2020-01-27 20:30:43.59088748 [ThreadId 36] - setTypecheckedModule: before ghc-mod
2020-01-27 20:30:43.590912458 [ThreadId 36] - Loading file
2020-01-27 20:30:43.590944646 [ThreadId 36] - setTypecheckedModule: before ghc-mod
2020-01-27 20:30:43.590974534 [ThreadId 36] - Loading file
2020-01-27 20:30:43.594380357 [ThreadId 36] - setTargets: [("/home/maks/temp/hie-th-repro/src/Exp.hs","/tmp/haskell-lsp20344/Exp.hs-00000-2500205673677564293.hs")]
2020-01-27 20:30:43.598452752 [ThreadId 36] - modGraph: [ModLocation {ml_hs_file = Just "/tmp/haskell-lsp20344/Exp.hs-00000-2500205673677564293.hs", ml_hi_file = "/home/maks/.cache/hie-bios/ed25cb57d327f65dd9783b25e177862111d7dc2f/Exp.hi", ml_obj_file = "/tmp/ghc20344_0/ghc_11.o"},ModLocation {ml_hs_file = Just "/home/maks/temp/hie-th-repro/src/TH.hs", ml_hi_file = "/home/maks/.cache/hie-bios/ed25cb57d327f65dd9783b25e177862111d7dc2f/TH.hi", ml_obj_file = "/tmp/ghc20344_0/ghc_12.o"}]
2020-01-27 20:30:43.618732823 [ThreadId 36] - init-plugins(loaded):0
2020-01-27 20:30:43.618775235 [ThreadId 36] - init-plugins(specified):0
2020-01-27 20:30:43.658905906 [ThreadId 36] - loaded /home/maks/temp/hie-th-repro/src/Exp.hs - /tmp/haskell-lsp20344/Exp.hs-00000-2500205673677564293.hs
2020-01-27 20:30:43.658969326 [ThreadId 36] - Typechecked modules for: Just "/tmp/haskell-lsp20344/Exp.hs-00000-2500205673677564293.hs"

2020-01-27 20:30:43.661610197 [ThreadId 36] - File, loaded
2020-01-27 20:30:43.661919143 [ThreadId 36] - setTypecheckedModule: after ghc-mod
2020-01-27 20:30:43.661946467 [ThreadId 36] - Diags: fromList []
2020-01-27 20:30:43.661974051 [ThreadId 36] - setTypecheckedModule: Did get typechecked module for: "/home/maks/temp/hie-th-repro/src/Exp.hs"
2020-01-27 20:30:43.662161055 [ThreadId 36] - setTypecheckedModule: done
2020-01-27 20:30:43.66223837 [ThreadId 36] - Diags: [(NormalizedUri "file:///home/maks/temp/hie-th-repro/src/Exp.hs",[])]
2020-01-27 20:30:43.662271778 [ThreadId 36] - ghcDispatcher: top of loop

So this is macOS specific in my case? Weird...

fendor commented 4 years ago

No, it is definitely not MacOS specific. It is some kind of race that we can not pinpoint so far. As said, I can reproduce it on NixOS, but only sometimes. For some time, I couldnt work on HIE code base at all, because it kept crashing, but currently I cant reproduce the issue. But it still is definitely present.

jbransen commented 4 years ago

I was trying out HIE and on a toy project it works great! But not on my real codebase due to this bug... I'm happy to help with fixing it, I can reproduce it consistently, but not sure where to start.

I'm working on a codebase with quite a bit of TH usage, on Ubuntu 18.04 in WSL (can't compile my project in Windows due to a GHC on Windows bug), with GHC 8.6.5. When running as LSP server the run ends with:

hie: loadObj: /tmp/ghc28794_0/ghc_82.o: file doesn't exist
2020-03-25 20:57:06.4533934 [ThreadId 61] - Scheduler thread exited unexpectedly: loadObj "/tmp/ghc28794_0/ghc_82.o": failed

and with --debug it ends with:

hie: loadObj: /tmp/ghc30068_0/ghc_82.o: file doesn't exist
hie: loadObj "/tmp/ghc30068_0/ghc_82.o": failed

The error is coming from the GHC.load call in ModuleCache.hs. I don't think it is a race in loading since I consistently get into the same error, so I have the impression that the state on my disk (some cache presumably) is in a "wrong state". I did have HIE working for this project once for a couple of minutes, I think after switching git branches and/or running stack build in a different terminal, so maybe I somehow invalidated the right cache. One more thing that I noticed is that the temporary directory name is different each time, but the filename is the same, e.g. from multiple runs I have:

hie: loadObj: /tmp/ghc28794_0/ghc_82.o: file doesn't exist
hie: loadObj: /tmp/ghc27800_0/ghc_82.o: file doesn't exist

Any pointers/ideas on what to check?

skress commented 4 years ago

@jbransen you may try to remove ~/.cache/hie-bios. When I do this on my toy project (which uses TH) on macOS I get back from the "file doesn't exist" problem to a seg fault when the TH code is run.

fendor commented 4 years ago

@jbransen No real pointers here, yet, IIRC I was able to reproduce the problem only with hie-bios check <filename> where the filename contained some TH. Since this project will eventually merge with ghcide, you could also give ghcide a try and see if it works better for your use-case. Or if you are brave, you can try-out hls which builds on ghcide but is not stable yet.

jbransen commented 4 years ago

@skress Ah, that is the cache dir I was looking for. Removing it means hie is doing more work, but it still ends in the same loadObj error so no segfaults here.

@fendor I looked at HLS but that is too alpha for me, but I didn't realize that ghcide had most features I was looking for already. Thanks for the tip!

wraithm commented 4 years ago

I got the same issue with a file that uses githash with TemplateHaskell. I can see that OP's example used gitrev, which is a very similar package. Perhaps there's something involving a call to git?

All of my other files in my (rather large!) project work great, including ones with rather complex TemplateHaskell invocations. My prime suspect is gitrev/githash.

jbransen commented 4 years ago

I am pretty sure it is not that. I did some testing and I can consistently reproduce this bug , where the object file that it fails on is always a file that itself does not use TH, but is (directly or indirectly) imported by a TH module. I think the nondeterminism in this can be explained by the build order that GHC picks, e.g. when some files changes GHC may pick a different build order in which the problem does not appear. It also seems that the project needs to be sufficiently large, maybe because otherwise everything is done in memory, and the problem only appears when writing to disk.

I believe this function in hie-bios is at least related to the problem. hscTarget = HscNothing, about which the GHC docs say:

HscNothing can be used to avoid generating any output, however, note that: If a program uses Template Haskell the typechecker may need to run code from an imported module. To facilitate this, code generation is enabled for modules imported by modules that use template haskell. See Note [-fno-code mode].

This last bit is not always happening, so it seems that some dependency tracking for TH modules is going wrong. However, the note for the setLinkerOptions function in hie-bios makes it clear that it once was setting the value to HscInterpreted instead of HscNothing. Doing that does solve the problem for me and I can now use HIE succesfully on my project! However, I am not sure that it is the real fix to this issue, because it should work with HscNothing as well, and my machine is now doing 'too much work' for modules that are not imported in TH modules. Maybe this does give a clue to the HIE devs though?

mpickering commented 4 years ago

@jbransen Thanks for looking into this but the issue will probably never be fixed in HIE as we are all working now on haskell-language-server and ghcide. So I would recommend using one of those if this problem is blocking you.

syntheorem commented 4 years ago

Just to throw out another data point, I also encountered this issue when using Template Haskell. In #1480 there was speculation that it was specific to TH code that runs IO, but my code is simply doing some code generation, so it appears to apply to any TH code.

Fortunately, checking out hie-bios and applying the hscTarget = HscInterpreted fix suggested by @jbransen also fixed the problem for me. So even if it doesn't get fixed in HIE, I really appreciate the investigation. Saved me a lot of frustration.

andrewguy9 commented 4 years ago

@mpickering, if development has moved to haskell-language-server do you think that the default for the VsCode: Haskell Language Server plugin Hie Variant setting should be changed from haskell-ide-engine to haskell-language-server?

fendor commented 4 years ago

@andrewguy9 I think that would make sense.

cc @jneira, @alanz maybe update the vscode plugin?