ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 114 forks source link

Crash on aarch64_apple_darwin after running tests successfully #350

Closed janvogt closed 2 years ago

janvogt commented 2 years ago

Observation

When using ghcid natively on apple silicon (using nix with system = "aarch64-darwin"), ghcid crashes after all tests ran.

ghcid -c "cabal repl test:tests" -T ":main"
Loading cabal repl test:tests ...
Build profile: -w ghc-8.10.7 -O1
In order, the following will be built (use -v for more details):
 - iban-0.1.1.1 (test:tests) (file test/Main.hs changed)
Preprocessing test suite 'tests' for iban-0.2.0.0..
GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
[1 of 8] Compiling Finance.IBAN.Data ( src/Finance/IBAN/Data.hs, interpreted )
[2 of 8] Compiling Finance.IBAN.Germany.Core ( src/Finance/IBAN/Germany/Core.hs, interpreted )
[3 of 8] Compiling Finance.IBAN.Germany.Data ( src/Finance/IBAN/Germany/Data.hs, interpreted )
[4 of 8] Compiling Finance.IBAN.Internal ( src/Finance/IBAN/Internal.hs, interpreted )
[5 of 8] Compiling Finance.IBAN.Germany ( src/Finance/IBAN/Germany.hs, interpreted )
[6 of 8] Compiling Finance.IBAN     ( src/Finance/IBAN.hs, interpreted )
[7 of 8] Compiling IBANRegistryExamples ( test/IBANRegistryExamples.hs, interpreted )
[8 of 8] Compiling Main             ( test/Main.hs, interpreted )
Ok, 8 modules loaded.
all tests
  IBAN Registry Examples validate
    iban "AL47212110090000000235698741":                                                                           OK (0.01s)
[... many more successful tests ...]

All 291 tests passed (1.91s)

...done
ghcid: internal error: evacuate(static): strange closure type 445112
    (GHC version 8.10.7 for aarch64_apple_darwin)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug
fish: Job 1, 'ghcid -c "cabal repl test:tests…' terminated by signal SIGABRT (Abort)

What I've tried

Conclusion

This points to ghcid triggering a GHC bug. Presumably, when watching for file changes, as the tests complete successfully befor crashing and using cabal directly works fine.

Next steps

To report the GHC bug, I'd need to provide a minimal repro of the relevant ghcid part... Unfortunately, I am not confident I'll be able to produce this myself. For now, using ghcid through rossetta 2 is an easy solution, so it's not a high priority issue, I guess. However, I'd be happy to help in any way I can to further research this.

ndmitchell commented 2 years ago

I think given GHC 8.10.7 is quite old now, and Apple Silicon improvements were advertised in the later 9.0 and 9.2 releases, I'd suggest trying one of those. Ghcid does a lot of :reload and that can stress the runtime linker, which is both pretty custom and a fertile source of bugs.

janvogt commented 2 years ago

Ok, got you. Thanks for the quick response!

I have to wait a little bit longer to switch to ghc 9.0, but a wontfix here is fine for me. I will just use x86_64 till I am able to upgrade.