ghcid
ghcid copied to clipboard
Blinking behaviour when using ghcid with GHC's Hadrian
When I load ghcid with as stated in the Hadrian README here: https://gitlab.haskell.org/trac-dredozubov/ghc/tree/master/hadrian, I get a weird blinking behavior I can't reproduce with any other project loaded in ghcid. I don't know how to describe it well, so I've recorded an asciicast: https://asciinema.org/a/HLNyp1WiwIstLbwMaPlM78kLe
I don't have any specific ghcid configuration globally and local .ghcid from the ghc repo looks like this:
% ls .ghci*
.ghcid
% cat .ghcid
--command ./hadrian/ghci.sh
--reload compiler
--reload ghc
--reload includes
--restart hadrian/
Here's how my ~/.ghci
looks like in case it matters:
% cat ~/.ghci
import System.Process
:def build (const $ return "System.Process.system \"cabal build -v0\"")
:seti -XOverloadedStrings
:set prompt "λ> "
:set -fobject-code
I wasn't sure where to report it first, but ghcid repo felt like the better place to start, maybe it's a known behavior for some cases.
Thanks for the ASCII cast. Can you try running the blinking thing with --verbose
to ghcid and send me/gist the output it produces? (Just kill it after 10s or so, so it's had time to do a few unnecessary reloads).
I see this bit repeating indefinitely: https://gist.github.com/dredozubov/cae6a77c6c7c34200da820b6e8ae1578
So the issue will be:
%NOTIFY: Modified "/Users/dr/workspace/ghc/compiler/deSugar/DsExpr.o-boot" 2019-06-07 12:16:04.421359 UTC False
It's expected that file might keep changing. What it shouldn't do is trigger a reload. Do you have a --reload
flag to ghcid?
Oh, I think the problem is that @dredozubov has set -fobject-code
without setting the output directory to be out of the build tree.
@ndmitchell not that I know of. I launch it with ghcid --command="./hadrian/ghci.sh"
. .ghcid
in the repo contains:
--command ./hadrian/ghci.sh
--reload compiler
--reload ghc
--reload includes
--restart hadrian/
@mpickering I removed the :set -fobject-code
line from my ~/.ghci
and the issue still persists.
Also I tried using different shells and disabling user configuration: zsh
, bash --noprofile --norc
@dredozubov Can you remove all the .o
and .o-boot
files from the build tree?
@mpickering I've disabled :set -fobject-code
and removed .o
and .o-boot
. Unfortunately, it doesn't seem to help.
:thinking: But how does ./hadrian/ghci.sh
produce any object files then?
Object files aside, I see the same behavior without any of them. I've compiled a new gist with ghcid --verbose
: https://gist.github.com/dredozubov/9fa43abd308e2811e10809845cfae061
Removing the -fobject-code
, purging the code tree from object files and starting ghcid with --verbose
produces Error when waiting, if this happens repeatedly, raise a ghcid bug. user error (could not create file system event stream)
as seen in the gist: https://gist.github.com/dredozubov/9fa43abd308e2811e10809845cfae061
I spoke with @ndmitchell earlier today and seems to be an issue with hfsevents, because it works fine if started with --poll
.
FYI I'm seeing much the same thing @dredozubov is seeing. I have nothing in my ~/.ghci, and I haven't tweaked any ghcid settings. I am simply running ghcid -c './hadrian/ghci.sh'
.
I see both the flickering as well as the "raise a ghcid bug" message. I did have *.o and *.o-boot files in my tree (maybe because I had used the make build at one point?), but I've removed them from compiler/, ghc/, and includes/ and the problems persist.
x86_64, "NixOS 19.03.172837.6c3826d1c93 (Koi)"
@chreekat Does --poll
fix the issues?
--poll
definitely helps and it seems it an issue with hfsevents
, but I haven't reported it yet. @chreekat do you use mac os as well?
@dredozubov nope, NixOS.
@mpickering --poll might help, but the problem didn't happen all the time, and I don't have much time to check now.
With and without --poll, ghcid is triggering rebuilds because of vim swap files, which are pretty noisy. Can that be avoided?
ghcid is also watching hadrian/dist-newstyle and hadrian/.ghc.environment.blah. Since I can't figure out how to disable generation of env files I guess I'm done for now. I really wish that wasn't on by default.