Skip to content

stack install Agda eats up all RAM and freezes computer; with resource limits, it yields "ghc: panic! (the 'impossible' happened)"

Summary

I wanted to install Agda, a package on Hackage. Running stack install Agda proceeds normally for a few minutes, but then my computer freezes. After waiting half an hour with no change, I turned it off. It then refused to turn back on again for several hours. When it eventually did, I used ulimit to limit the process's "maximum resident set size" and "virtual memory" to 2.5 GiB each (I have an ~8 GiB RAM). (I don't actually know what the difference between the two is or if those are reasonable sizes.)

I then ran stack install. As before, it worked fine for a bit, appearing to complete 125/357 tasks successfully, then crashed with this message:

[126 of 357] Compiling Agda.Syntax.Internal ( src/full/Agda/Syntax/Internal.hs, .stack-work/dist/x86_64-linux/Cabal-2.4.0.1/build/Agda/Syntax/Internal.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.6.5 for x86_64-unknown-linux):
        Loading temp shared object failed: /tmp/ghc25645_0/libghc_1023.so: failed to map segment from shared object
                      
Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
                    
--  While building package Agda-2.6.0.1 using:
      /home/my_name/.local/opt/agda/.stack-work/dist/x86_64-linux/Cabal-2.4.0.1/setup/setup --builddir=.stack-work/dist/x86_64-linux/Cabal-2.4.0.1 build lib:Agda exe:agda exe:agda-mode --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

Steps to reproduce

$ ulimit -m 2621440 -v 2621440
$ stack install -- Agda

My ~/.stack/config.yaml file (with personal info redacted) is attached.

Expected behavior

Agda gets successfully installed.

Actual behavior

Agda fails to install with the above error.

Environment

  • GHC version used: ghc-8.6.5
  • Operating System: Arch Linux 5.0.13
  • System Architecture: x86_64
  • ~/.stack/config.yaml: Attached

config.yaml

Edited by greatBigDot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information