ihp icon indicating copy to clipboard operation
ihp copied to clipboard

Tutorial breaks at "Hello Haskell World"

Open fghibellini opened this issue 3 years ago • 6 comments

I followed the tutorial at [link] and it worked all the way to actually running the app. But then it tells you to change the code of the view and see it magically live-reload in the browser but instead it logs the following:

AsyncCancelled
StatusServer: Cannot stop as not running
Ok, 11 modules loaded.
<interactive>: fatal:
    cannot find object file for module `Web.View.Prelude'
    while linking an interpreted expression
package flags have changed, resetting and loading new packages...
IHP> [ 1 of 13] Compiling Application.Helper.Controller ( Application/Helper/Controller.hs, interpreted )
[ 2 of 13] Compiling Application.Helper.View ( Application/Helper/View.hs, interpreted )
[ 3 of 13] Compiling Config           ( Config/Config.hs, interpreted )
[ 4 of 13] Compiling Generated.Types  ( build/Generated/Types.hs, interpreted )
[ 5 of 13] Compiling Web.Types        ( Web/Types.hs, interpreted )
[ 6 of 13] Compiling Web.Routes       ( Web/Routes.hs, interpreted )
[ 7 of 13] Compiling Web.Controller.Prelude ( Web/Controller/Prelude.hs, interpreted )
[ 8 of 13] Compiling Web.View.Layout  ( Web/View/Layout.hs, interpreted )
[ 9 of 13] Compiling Web.View.Prelude ( Web/View/Prelude.hs, interpreted )
[10 of 13] Compiling Web.View.Static.Welcome ( Web/View/Static/Welcome.hs, interpreted )
[11 of 13] Compiling Web.Controller.Static ( Web/Controller/Static.hs, interpreted )
[12 of 13] Compiling Web.FrontController ( Web/FrontController.hs, interpreted )
[13 of 13] Compiling Main             ( Main.hs, interpreted )
Ok, 13 modules loaded.

The server then stops accepting requests from the browser (on port 8000, the administration view on port 8001 seems to be working fine).

Killing ./start and running it again makes the application work again (including my changes), until I change the source again which triggers the same error.

Possibly related to #946

fghibellini avatar Nov 30 '21 23:11 fghibellini

That's very strange. Thanks for reporting.

I think the error has something to do with:

<interactive>: fatal:
    cannot find object file for module `Web.View.Prelude'
    while linking an interpreted expression

Can you run DEBUG=1 ./start, reproduce the issue again and then paste the logs here? That should give a little more output to better understand what happens

mpscholten avatar Dec 01 '21 07:12 mpscholten

Also can you run the auto troubleshoot script at https://ihp.digitallyinduced.com/Guide/troubleshooting.html ? This will check for many common issues automatically

mpscholten avatar Dec 01 '21 07:12 mpscholten

It actually worked the first time I ran it with DEBUG=1, but just once - all following attempts fail (both file changes or file changes after a restart of the script - concurrency issue?).

DEBUG=1 ./start
direnv: loading ~/code/prvni/.envrc
direnv: export ~PATH
IHP Version: 0.16.0
Opening in existing browser session.
[36mGET[0m /
[37m  Accept: [0mtext/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
[37m  Status: [0m[32m200 OK[0m 0.001648774s

 ===> AppState {postgresState = NotStarted, appGHCIState = NotStarted, statusServerState = NotStarted, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = NotStarted, toolServerState = NotStarted}
UpdateToolServerState Started
 ===> AppState {postgresState = NotStarted, appGHCIState = NotStarted, statusServerState = NotStarted, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = NotStarted, toolServerState = Started}
UpdateStatusServerState Started
 ===> AppState {postgresState = NotStarted, appGHCIState = NotStarted, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = NotStarted, toolServerState = Started}
UpdatePostgresState Started
 ===> AppState {postgresState = Started, appGHCIState = NotStarted, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = NotStarted, toolServerState = Started}
UpdateFileWatcherState Started
 ===> AppState {postgresState = Started, appGHCIState = NotStarted, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
[("ihpVersion","0.16.0"),("os","linux"),("arch","x86_64"),("projectId","3c1dc4c92b8c400e6b0175e57d0cdea63ccdd68022e6f523fbb8258c8bf567a972e1a9cfe7e8126bd09a5ebedfdc1febdd2d4214a1ac1a4143c7b8910cd19d1d")]
GHCI: :script build/ihp-lib//applicationGhciConfig
GHCI: :set prompt ""
GHCI: import qualified ClassyPrelude
GHCI: :l Main.hs
UpdateAppGHCIState Loading
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
2021-12-01 16:09:44.956 CET [20419] LOG:  starting PostgreSQL 13.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 10.3.0, 64-bit
2021-12-01 16:09:44.959 CET [20419] LOG:  listening on Unix socket "/home/ghibe/code/prvni/build/db/.s.PGSQL.5432"
ReceiveAppOutput {line = StandardOutput "GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
2021-12-01 16:09:44.968 CET [20469] LOG:  database system was shut down at 2021-12-01 15:59:22 CET
2021-12-01 16:09:44.973 CET [20419] LOG:  database system is ready to accept connections
ReceiveAppOutput {line = StandardOutput "package flags have changed, resetting and loading new packages..."}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "Loaded GHCi configuration from .ghci"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
IHP Telemetry is activated. This can be disabled by setting env variable IHP_TELEMETRY_DISABLED=1
ReceiveAppOutput {line = StandardOutput "\ESC[38;5;208m\STXIHP>\ESC[m\STX package flags have changed, resetting and loading new packages..."}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "\ESC[38;5;208m\STXIHP>\ESC[m\STX [ 1 of 13] Compiling Application.Helper.Controller ( Application/Helper/Controller.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 2 of 13] Compiling Application.Helper.View ( Application/Helper/View.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 3 of 13] Compiling Config           ( Config/Config.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 4 of 13] Compiling Generated.Types  ( build/Generated/Types.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 5 of 13] Compiling Web.Types        ( Web/Types.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 6 of 13] Compiling Web.Routes       ( Web/Routes.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 7 of 13] Compiling Web.Controller.Prelude ( Web/Controller/Prelude.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 8 of 13] Compiling Web.View.Layout  ( Web/View/Layout.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 9 of 13] Compiling Web.View.Prelude ( Web/View/Prelude.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[10 of 13] Compiling Web.View.Static.Welcome ( Web/View/Static/Welcome.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[11 of 13] Compiling Web.Controller.Static ( Web/Controller/Static.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[12 of 13] Compiling Web.FrontController ( Web/FrontController.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[13 of 13] Compiling Main             ( Main.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Started, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
AppModulesLoaded {success = True}
GHCI: app <- ClassyPrelude.async (main `catch` \(e :: SomeException) -> IHP.Prelude.putStrLn (tshow e))
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
AppStarted
 ===> AppState {postgresState = Started, appGHCIState = Running, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "\ESC[36mGET\ESC[0m /"}
 ===> AppState {postgresState = Started, appGHCIState = Running, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "\ESC[37m  Accept: \ESC[0mtext/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"}
 ===> AppState {postgresState = Started, appGHCIState = Running, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "\ESC[37m  Status: \ESC[0m\ESC[32m200 OK\ESC[0m 0.000742664s"}
 ===> AppState {postgresState = Started, appGHCIState = Running, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
[36mGET[0m /
[37m  Accept: [0m

ReceiveAppOutput {line = StandardOutput ""}
 ===> AppState {postgresState = Started, appGHCIState = Running, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}

<HERE THE FILE WAS CHANGED>

HaskellFileChanged
GHCI: ClassyPrelude.uninterruptibleCancel app
GHCI: :r
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "AsyncCancelled"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
AppModulesLoaded {success = True}
GHCI: app <- ClassyPrelude.async (main `catch` \(e :: SomeException) -> IHP.Prelude.putStrLn (tshow e))
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = ErrorOutput "<interactive>: fatal:"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
GHCI: :script build/ihp-lib//applicationGhciConfig
GHCI: :set prompt ""
GHCI: import qualified ClassyPrelude
GHCI: :l Main.hs
ReceiveAppOutput {line = ErrorOutput "Linking Issue: Reloading Main"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = ErrorOutput "    while linking an interpreted expression"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "package flags have changed, resetting and loading new packages..."}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "\ESC[38;5;208m\STXIHP>\ESC[m\STX [ 1 of 13] Compiling Application.Helper.Controller ( Application/Helper/Controller.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 2 of 13] Compiling Application.Helper.View ( Application/Helper/View.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 3 of 13] Compiling Config           ( Config/Config.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 4 of 13] Compiling Generated.Types  ( build/Generated/Types.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 5 of 13] Compiling Web.Types        ( Web/Types.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 6 of 13] Compiling Web.Routes       ( Web/Routes.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 7 of 13] Compiling Web.Controller.Prelude ( Web/Controller/Prelude.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 8 of 13] Compiling Web.View.Layout  ( Web/View/Layout.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[ 9 of 13] Compiling Web.View.Prelude ( Web/View/Prelude.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[10 of 13] Compiling Web.View.Static.Welcome ( Web/View/Static/Welcome.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[11 of 13] Compiling Web.Controller.Static ( Web/Controller/Static.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[12 of 13] Compiling Web.FrontController ( Web/FrontController.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[13 of 13] Compiling Main             ( Main.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
AppModulesLoaded {success = True}
AppGHCIModulesLoaded triggered multiple times. This happens when multiple file change events are detected. Skipping app start as the app is already starting from a previous file change event
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
troubleshooting script output
Checking that the current directory is an IHP project:
+ Found Main.hs
+ Found start script
+ Nix installed
Checking direnv:
+ Found .envrc
+ direnv loads .envrc
+ direnv allows .envrc
+ ghci is loaded from nix store
Checking .ghci:
+ Found .ghci
+ .ghci permissions are ok
Checking IHP:
+ Symlink build/ihp-lib exists
+ Symlink build/ihp-lib target exists
+ IHP used from nix
Checking Cachix:
+ Cachix exists
+ digitallyinduced.cachix.org configured
+ No legacy cachix key found
Checking IHP files:
Debugging Details:
GHCI Output:
GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
*** WARNING: . is writable by someone else, IGNORING!
Suggested fix: execute 'chmod go-w .'
Prelude> ok
Prelude> Leaving GHCi.

build/ihp-lib Target:
/nix/store/kq65wynaxf8f0kmrx698npsrdg63g8fy-ghc-8.10.7-with-packages/bin/../lib/IHP
Direnv Output:
direnv exec path /nix/store/lw11rwn4di70vzdafaajjx49yva8ahj8-direnv-2.28.0/bin/direnv
DIRENV_CONFIG /home/ghibe/.config/direnv
bash_path /nix/store/dpjnjrqbgbm8a5wvi1hya01vd8wyvsq4-bash-4.4-p23/bin/bash
disable_stdin false
warn_timeout 5s
whitelist.prefix []
whitelist.exact map[]
Loaded RC path /home/ghibe/code/prvni/.envrc
Loaded watch: ".envrc" - 2021-11-30T23:52:25+01:00
Loaded watch: "../../.local/share/direnv/allow/eca6a96b99cba041ae4b0073492006e0c6e82b75073e74d019f5e2aa98b82835" - 2021-12-01T16:09:44+01:00
Loaded RC allowed false
Loaded RC allowPath 
Found RC path /home/ghibe/code/prvni/.envrc
Found watch: ".envrc" - 2021-11-30T23:52:25+01:00
Found watch: "../../.local/share/direnv/allow/eca6a96b99cba041ae4b0073492006e0c6e82b75073e74d019f5e2aa98b82835" - 2021-12-01T16:09:44+01:00
Found RC allowed true
Found RC allowPath /home/ghibe/.local/share/direnv/allow/eca6a96b99cba041ae4b0073492006e0c6e82b75073e74d019f5e2aa98b82835

which direnv Output:
/nix/store/kq65wynaxf8f0kmrx698npsrdg63g8fy-ghc-8.10.7-with-packages/bin/ghci

default.nix:
let
    ihp = builtins.fetchGit {
        url = "https://github.com/digitallyinduced/ihp.git";
        ref = "refs/tags/v0.16.0";
    };

OS:
Linux-5.13.0-22-generic-x86_64-with-glibc2.34

I also tried to start ghci the way DevServer does and run the commands that it runs myself and it all seems to be working fine.

fghibellini avatar Dec 01 '21 15:12 fghibellini

In the auto troubleshooting output it says

Debugging Details:
GHCI Output:
GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
*** WARNING: . is writable by someone else, IGNORING!
Suggested fix: execute 'chmod go-w .'

Can you try to fix that and then check if the error still happens?

In generally I agree with your point that it looks like a concurrency issue. But first want to make sure it's not because of that GHC warning above :)

mpscholten avatar Dec 01 '21 17:12 mpscholten

I ran chmod go-w . and the warning in the troubleshooting script went away. It did not change the above described behavior.

Though I noticed that you can even fix the session simply by saving the file a few times. The bug just happens randomly.

fghibellini avatar Dec 01 '21 17:12 fghibellini

👍

Based on the log output of DEBUG=1 it enters this branch: https://github.com/digitallyinduced/ihp/blob/master/exe/IHP/IDE/DevServer.hs#L309

 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = ErrorOutput "<interactive>: fatal:"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
GHCI: :script build/ihp-lib//applicationGhciConfig
GHCI: :set prompt ""
GHCI: import qualified ClassyPrelude
GHCI: :l Main.hs
ReceiveAppOutput {line = ErrorOutput "Linking Issue: Reloading Main"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = LiveReloadNotificationServerState, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = ErrorOutput "    while linking an interpreted expression"}

That triggers a full reload of ghci (which typically fixes these problems). During the reload the appGHCIState is still set to Loaded. It should be reset to Loading here.

The Loaded state now causes AppGHCIModulesLoaded triggered multiple times. This happens when multiple file change events are detected. Skipping app start as the app is already starting from a previous file change event once the full ghci reload has finished.

I'll push a possible fix quickly.

mpscholten avatar Dec 01 '21 20:12 mpscholten

@mpscholten can this be closed?

francisdb avatar Jan 30 '23 16:01 francisdb

Yes 👍

mpscholten avatar Jan 30 '23 16:01 mpscholten