montmorencymontmorencyIHP Contributor

Live Loading Code

I'm finding the live loading in the browser sometimes dies while I'm editing the code. My setup is on MacOs Mojave/Firefox and I'm editing the haskell code directly using VI/nerdtree. The IHP development server is still running but I'm getting a log of: StatusServer: Cannot stop as not running and the page formatting in the browser isn't updating.Is there a simple way of restarting the Server without killing the development environment and running the start script again?

marcmarcdi Team

Can you try to start the server in debug mode:

DEBUG=1 ./start

This will print lot's of debugging output. It would be very useful if you can share a log of one case where this problem occured. This way we can maybe find the root cause.

montmorencymontmorencyIHP Contributor

Looks like the statusServer is paused. Seems to happen after a compilation. I wonder if it has to do with .swp files.

ReceiveAppOutput {line = StandardOutput "\ESC[37m  Status: \ESC[0m\ESC[32m200 OK\ESC[0m 0.000067s"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = Started, fileWatcherState = Started, toolServerState = Started}
Chandra KoduruChandra Koduru

Live Loading is failing even on my box. I am on Nixos20.09. Just installed IHP. I ran "DEBUG=1 ./start" from a fish-shell. I am observing the following debug note:

HaskellFileChanged
GHCI: ClassyPrelude.uninterruptibleCancel app
GHCI: :r
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Paused, liveReloadNotificationServerState = Started, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "(0.00 secs, 106,472 bytes)"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Paused, liveReloadNotificationServerState = Started, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "[15 of 18] Compiling Web.View.Posts.New ( Web/View/Posts/New.hs, interpreted )"}
 ===> AppState {postgresState = Started, appGHCIState = Loading, statusServerState = Paused, liveReloadNotificationServerState = Started, fileWatcherState = Started, toolServerState = Started}
AppModulesLoaded {success = True}
StatusServer: Cannot stop as not running
GHCI: app <- ClassyPrelude.async main
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = Started, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "Collecting type info for 1 module(s) ... "}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = Started, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "(0.01 secs, 107S,e5r1v2e rb ystteasr)t"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = Started, fileWatcherState = Started, toolServerState = Started}
ReceiveAppOutput {line = StandardOutput "ed"}
 ===> AppState {postgresState = Started, appGHCIState = Loaded, statusServerState = Paused, liveReloadNotificationServerState = Started, fileWatcherState = Started, toolServerState = Started}

marcmarcdi Team

We found out that the issue has been caused by some custom flags in .ghc/ghci.conf. The workaround is to remove that file.

We also fixed the local dev server to automatically ignore that file via https://github.com/digitallyinduced/ihp/commit/8b6e1bfbaf13b31ace21c6d12316cb4173ae6344 Will be part of the next IHP release.