haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.61k stars 691 forks source link

Cabal ~OOM (5G+ RSS) (likely duplicate of #4589) #5201

Closed deepfire closed 6 years ago

deepfire commented 6 years ago

Likely a duplicate of #4589, but submitting as new, because the latter was closed and this has been half a year and a compiler release since..

cabal-install revision: 728ad1a1e066da453ae13ee479629c00d8c2f32d GHC 8.4.1 revision: 0a3e2f324dbd525d626ebd3d97e8ffa1cf2f0ffb (release)

[nix-shell:~/data-default/data-default]$ cabal clean
cleaning...

[nix-shell:~/data-default/data-default]$ cabal -v -v -v -v configure
/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in
/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin
found ghc-pkg in
/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc-pkg
/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc-pkg --version
/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc --supported-languages
/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc --info
Reading available packages of hackage.haskell.org...
Using most recent state (could not read timestamp file)
Warning: The package list for 'hackage.haskell.org' is 60 days old.
Run 'cabal update' to get the latest list of available packages.
^C^C

[nix-shell:~/data-default/data-default]$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.4.1

[nix-shell:~/data-default/data-default]$ cabal --version
cabal-install version 2.2.0.0
compiled using version 2.2.0.0 of the Cabal library

[nix-shell:~/data-default/data-default]$ git log -n1
commit b1a08788ca3d6a714319726e3768cf93df92458e
Author: Lukas Mai <l.mai@web.de>
Date:   Sun Jun 19 13:36:41 2016 +0200

    drop instances-base from dependencies (#7)

Notes

  1. Running /nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc --info inside the same directory is fine, and yields Output [1]

Output

  1. nix-shell:~/data-default/data-default]$  /nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc --info
    [("Project name","The Glorious Glasgow Haskell Compilation System")
    ,("GCC extra via C opts"," -fwrapv -fno-builtin")
    ,("C compiler command","/nix/store/gqg2vrcq7krqi9rrl6pphvsg81sb8pjw-gcc-wrapper-7.3.0/bin/cc")
    ,("C compiler flags"," -fno-stack-protector")
    ,("C compiler link flags"," ")
    ,("C compiler supports -no-pie","YES")
    ,("Haskell CPP command","/nix/store/gqg2vrcq7krqi9rrl6pphvsg81sb8pjw-gcc-wrapper-7.3.0/bin/cc")
    ,("Haskell CPP flags","-E -undef -traditional")
    ,("ld command","/nix/store/cmxaqb5cbzy4jk26na842n6hy1s4yn19-binutils-wrapper-2.28.1/bin/ld")
    ,("ld flags","")
    ,("ld supports compact unwind","YES")
    ,("ld supports build-id","YES")
    ,("ld supports filelist","NO")
    ,("ld is GNU ld","YES")
    ,("ar command","ar")
    ,("ar flags","q")
    ,("ar supports at file","YES")
    ,("ranlib command","/nix/store/b0zlxla7dmy1iwc3g459rjznx59797xy-binutils-2.28.1/bin/ranlib")
    ,("touch command","touch")
    ,("dllwrap command","/bin/false")
    ,("windres command","/bin/false")
    ,("libtool command","libtool")
    ,("perl command","/nix/store/s029gmjpgvm776wfb56naqny9qja9339-perl-5.24.3/bin/perl")
    ,("cross compiling","NO")
    ,("target os","OSLinux")
    ,("target arch","ArchX86_64")
    ,("target word size","8")
    ,("target has GNU nonexec stack","True")
    ,("target has .ident directive","True")
    ,("target has subsections via symbols","False")
    ,("target has RTS linker","YES")
    ,("Unregisterised","NO")
    ,("LLVM llc command","llc")
    ,("LLVM opt command","opt")
    ,("LLVM clang command","clang")
    ,("Project version","8.4.1")
    ,("Project Git commit id","0a3e2f324dbd525d626ebd3d97e8ffa1cf2f0ffb")
    ,("Booter version","8.2.1")
    ,("Stage","2")
    ,("Build platform","x86_64-unknown-linux")
    ,("Host platform","x86_64-unknown-linux")
    ,("Target platform","x86_64-unknown-linux")
    ,("Have interpreter","YES")
    ,("Object splitting supported","YES")
    ,("Have native code generator","YES")
    ,("Support SMP","YES")
    ,("Tables next to code","YES")
    ,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn")
    ,("RTS expects libdw","NO")
    ,("Support dynamic-too","YES")
    ,("Support parallel --make","YES")
    ,("Support reexported-modules","YES")
    ,("Support thinning and renaming package flags","YES")
    ,("Support Backpack","YES")
    ,("Requires unified installed package IDs","YES")
    ,("Uses package keys","YES")
    ,("Uses unit IDs","YES")
    ,("Dynamic by default","NO")
    ,("GHC Dynamic","YES")
    ,("GHC Profiled","NO")
    ,("Leading underscore","NO")
    ,("Debug on","False")
    ,("LibDir","/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1")
    ,("Global Package DB","/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1/package.conf.d")
    ]
  2. Output of strace -f -eexecve -s1024 cabal -v -v -v -v configure:
    execve("/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/cabal", ["cabal", "-v", "-v", "-v", "-v", "configure"], 0x7ffce3b23580 /* 130 vars */) = 0
    strace: Process 1764 attached
    strace: Process 1767 attached
    strace: Process 1768 attached
    strace: Process 1769 attached
    strace: Process 1770 attached
    [pid  1770] execve("/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc", ["/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc", "--numeric-version"], 0x7ffc312a2320 /* 130 vars */) = 0
    [pid  1770] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc", "-B/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1", "--numeric-version"], 0x860008 /* 129 vars */) = 0
    [pid  1770] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc", "-B/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1", "-B/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1", "--numeric-version"], 0xd9e008 /* 129 vars */) = 0
    strace: Process 1772 attached
    strace: Process 1773 attached
    strace: Process 1774 attached
    strace: Process 1776 attached
    [pid  1774] +++ exited with 0 +++
    [pid  1773] +++ exited with 0 +++
    [pid  1776] +++ exited with 0 +++
    [pid  1772] +++ exited with 0 +++
    [pid  1770] +++ exited with 0 +++
    [pid  1755] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1770, si_uid=1000, si_status=0, si_utime=5, si_stime=2} ---
    strace: Process 1777 attached
    [pid  1777] execve("/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc-pkg", ["/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc-pkg", "--version"], 0x7ffc312a2320 /* 130 vars */) = 0
    [pid  1777] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc-pkg", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc-pkg", "--global-package-db=/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1/package.conf.d", "--version"], 0x1b98008 /* 130 vars */) = 0
    [pid  1777] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc-pkg", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc-pkg", "--global-package-db", "/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/package.conf.d", "--global-package-db=/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1/package.conf.d", "--version"], 0x177e008 /* 129 vars */) = 0
    [pid  1777] +++ exited with 0 +++
    [pid  1755] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1777, si_uid=1000, si_status=0, si_utime=3, si_stime=1} ---
    strace: Process 1778 attached
    [pid  1778] execve("/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc", ["/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc", "--supported-languages"], 0x4200099b00 /* 130 vars */) = 0
    [pid  1778] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc", "-B/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1", "--supported-languages"], 0xd53008 /* 129 vars */) = 0
    [pid  1778] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc", "-B/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1", "-B/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1", "--supported-languages"], 0x1575008 /* 129 vars */) = 0
    strace: Process 1780 attached
    strace: Process 1783 attached
    strace: Process 1814 attached
    strace: Process 1815 attached
    [pid  1814] +++ exited with 0 +++
    [pid  1783] +++ exited with 0 +++
    [pid  1815] +++ exited with 0 +++
    [pid  1780] +++ exited with 0 +++
    [pid  1778] +++ exited with 0 +++
    [pid  1755] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1778, si_uid=1000, si_status=0, si_utime=4, si_stime=2} ---
    strace: Process 1816 attached
    [pid  1816] execve("/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc", ["/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc", "--info"], 0x42000a4b00 /* 130 vars */) = 0
    [pid  1816] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc", "-B/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1", "--info"], 0x838008 /* 129 vars */) = 0
    [pid  1816] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc", "-B/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1", "-B/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1", "--info"], 0x12c7008 /* 129 vars */) = 0
    strace: Process 1817 attached
    strace: Process 1820 attached
    strace: Process 1822 attached
    strace: Process 1823 attached
    [pid  1822] +++ exited with 0 +++
    [pid  1823] +++ exited with 0 +++
    [pid  1820] +++ exited with 0 +++
    [pid  1817] +++ exited with 0 +++
    [pid  1816] +++ exited with 0 +++
    [pid  1755] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1816, si_uid=1000, si_status=0, si_utime=7, si_stime=2} ---
    strace: Process 1835 attached
    [pid  1835] execve("/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc-pkg", ["/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc-pkg", "dump", "--global", "-v0"], 0x42000b6b00 /* 130 vars */) = 0
    [pid  1835] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc-pkg", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc-pkg", "--global-package-db=/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1/package.conf.d", "dump", "--global", "-v0"], 0xc10008 /* 130 vars */) = 0
    [pid  1835] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc-pkg", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc-pkg", "--global-package-db", "/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/package.conf.d", "--global-package-db=/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1/package.conf.d", "dump", "--global", "-v0"], 0x1ff2008 /* 129 vars */) = 0
    [pid  1835] --- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TIMER, si_timerid=0, si_overrun=0, si_value={int=0, ptr=NULL}} ---
    [pid  1835] --- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TIMER, si_timerid=0, si_overrun=0, si_value={int=0, ptr=NULL}} ---
    [pid  1835] +++ exited with 0 +++
    [pid  1767] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1835, si_uid=1000, si_status=0, si_utime=6, si_stime=2} ---
    strace: Process 1842 attached
    [pid  1842] execve("/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc-pkg", ["/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc-pkg", "dump", "--user", "-v0"], 0x4200084b00 /* 130 vars */) = 0
    [pid  1842] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc-pkg", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc-pkg", "--global-package-db=/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1/package.conf.d", "dump", "--user", "-v0"], 0xe75008 /* 130 vars */) = 0
    [pid  1842] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc-pkg", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc-pkg", "--global-package-db", "/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/package.conf.d", "--global-package-db=/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1/package.conf.d", "dump", "--user", "-v0"], 0x1839008 /* 129 vars */) = 0
    [pid  1842] --- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TIMER, si_timerid=0, si_overrun=0, si_value={int=0, ptr=NULL}} ---
    [pid  1842] +++ exited with 0 +++
    [pid  1755] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1842, si_uid=1000, si_status=0, si_utime=4, si_stime=2} ---
    strace: Process 1847 attached
    [pid  1847] execve("/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc", ["/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/bin/ghc", "--print-libdir"], 0x42000c9b00 /* 130 vars */) = 0
    [pid  1847] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/bin/ghc", "-B/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1", "--print-libdir"], 0xe8d008 /* 129 vars */) = 0
    [pid  1847] execve("/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc", ["/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1/bin/ghc", "-B/nix/store/0iviri0xz7jc58alizv5axzmkrwjkdyk-ghc-8.4.1/lib/ghc-8.4.1", "-B/nix/store/k79gs1h0y3mvqj5rd8xvw1z6rnd8clap-ghc-8.4.1-with-packages/lib/ghc-8.4.1", "--print-libdir"], 0x1fe8008 /* 129 vars */) = 0
    strace: Process 1848 attached
    strace: Process 1851 attached
    strace: Process 1852 attached
    strace: Process 1854 attached
    [pid  1852] +++ exited with 0 +++
    [pid  1851] +++ exited with 0 +++
    [pid  1854] +++ exited with 0 +++
    [pid  1848] +++ exited with 0 +++
    [pid  1847] +++ exited with 0 +++
    [pid  1755] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1847, si_uid=1000, si_status=0, si_utime=5, si_stime=3} ---
    Warning: The package list for 'hackage.haskell.org' is 60 days old.
    Run 'cabal update' to get the latest list of available packages.
    [pid  1755] --- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
    strace: Process 1755 detached
    strace: Process 1764 detached
    strace: Process 1767 detached
    strace: Process 1768 detached
    strace: Process 1769 detached
deepfire commented 6 years ago

As an addition, the reproduction can be facilitated using the following Nixpkgs commit: https://github.com/NixOS/nixpkgs/pull/36781/commits/2c5d8e63a384bc7fcfa2aecd94ce355f10814180

hvr commented 6 years ago

@deepfire if it's easy for you, could you run cabal w/ the cabal +RTS -hT -RTS flags to generate a heap profile (works with the standard RTS; no need for the profiling RTS), and graph that via hp2ps or some other tool and attach a plot here?

deepfire commented 6 years ago

@hvr, both the profile and the rendered PS are at: https://mega.nz/#F!XJpzgKgZ!q9QXfRkPYgg9B-wAOcbRuw

hvr commented 6 years ago

@deepfire thx... so what's apparent to me is there's at the very least a serious space-leak building up; but that's possibly just an accidental additional issue exposed by this.

I suspect something some loop or infinite data (maybe stdout data?) accumulation thing to be going on.

deepfire commented 6 years ago

The unabridged strace of cabal configure, up to the point of its death at the hands of the OOM killer is also available there.

deepfire commented 6 years ago

Interestingly, the final file reads of the process were:

[pid 26705] read(16, "cabal-install/1.22.4.0/cabal-install.cabal0000006440000045230000000000000000021077001252221670500020677 0ustar0000ryantHackage000000000000000000Name:               cabal-install\nVersion:            1.22.4.0\nSynopsis:           The command-line interface for Cabal and Hackage.\nDescription:\n    The \\'cabal\\' command-line program simplifies the process of managing\n    Haskell software by automating the fetching, configuration, compilation\n    and installation of Haskell libraries and programs.\nhomepage:           http://www.haskell.org/cabal/\nbug-reports:        https://github.com/haskell/cabal/issues\nLicense:            BSD3\nLicense-File:       LICEN"..., 8192) = 8192
[pid 26705] read(16, ": network-uri < 2.6, network < 2.6\n\n  if os(windows)\n    build-depends: Win32\n    cpp-options: -DWIN32\n  else\n    build-depends: unix\n\n  if arch(arm)\n    cc-options:  -DCABAL_NO_THREADED\n  else\n    ghc-options: -threaded\n  default-language: Haskell2010\n\n-- Large, system tests that build packages.\ntest-suite package-tests\n  type: exitcode-stdio-1.0\n  hs-source-dirs: tests\n  main-is: PackageTests.hs\n  other-modules:\n    PackageTests.Exec.Check\n    PackageTests.Freeze.Check\n    PackageTests.MultipleSource.Check\n    PackageTests.PackageTester\n  build-depends:\n    Cabal,\n    HUnit,\n    QuickCheck >= 2.1.0.1 && < 2.8,\n    base,\n    bytestring,\n    directory,\n    extensible-exceptions,\n    filepath,\n    process,\n    regex-posix,\n    test-framework,\n    test-framework-hunit,\n    test-framework-quickcheck2 >= 0.2.12\n\n  if os(windows)\n    build-depends: Win32 >= 2 && < 3\n    cpp-options: -DWIN32\n  else\n    build-depends: unix >= 2.0 && < 2.8\n\n  if arch(arm)\n    cc-options:  -DCABAL_NO_THREADED\n  else\n    ghc-options: -"..., 8192) = 8192
[pid 26705] read(16, "cabal-install/1.20.1.0/cabal-install.cabal0000006440000045230000000000000000016526001252222102600020665 0ustar0000ryantHackage000000000000000000Name:               cabal-install\nVersion:            1.20.1.0\nSynopsis:           The command-line interface for Cabal and Hackage.\nDescription:\n    The \\'cabal\\' command-line program simplifies the process of managing\n    Haskell software by automating the fetching, configuration, compilation\n    and installation of Haskell libraries and programs.\nhomepage:           http://www.haskell.org/cabal/\nbug-reports:        https://github.com/haskell/cabal/issues\nLicense:            BSD3\nLicense-File:       LICEN"..., 8192) = 8192

cabal-install reading information about itself, then OOMing.. just correlation or something bigger?

deepfire commented 6 years ago

..and the FD being read is:

[pid 26705] openat(AT_FDCWD, "/home/deepfire/.cabal/packages/hackage.haskell.org/01-index.tar", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 16
hvr commented 6 years ago

Fwiw, I did try to reproduce this locally w/ cabal get data-default-0.7.1.1 and

$ PATH=/opt/ghc/8.4.1/bin:$PATH  /opt/cabal/2.2/bin/cabal configure -v -v -v -v  +RTS -s
/opt/ghc/8.4.1/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in /opt/ghc/8.4.1/bin
found ghc-pkg in /opt/ghc/8.4.1/bin/ghc-pkg
/opt/ghc/8.4.1/bin/ghc-pkg --version
/opt/ghc/8.4.1/bin/ghc --supported-languages
/opt/ghc/8.4.1/bin/ghc --info
Reading available packages of hackage.haskell.org...
Using most recent state specified from most recent cabal update
index-state(hackage.haskell.org) = 2018-03-11T11:51:23Z
/usr/bin/pkg-config --version
/usr/bin/pkg-config --list-all
/usr/bin/pkg-config --modversion sqlite3 shared-mime-info blkid libfreenect pixman-1 iso-codes gmodule-export-2.0 libevent_pthreads xaw7 gstreamer-interfaces-0.10 cairo-svg libdrm_intel recordproto nettle gnutls libpcreposix lapack-netlib lqr-1 atk-bridge-2.0 m17n-gui libelf cairo-tee xcb-render dbus-1 e2p dri fftw3 xkbcommon dri3proto libzmq udisks systemd gnome-icon-theme-symbolic libbsd SDL_gfx wayland-cursor gstreamer-pbutils-0.10 libcurl pangoxft QtDBus xcursor cairo-png xft libidn adwaita-icon-theme libxslt glu 'gtk+-x11-3.0' gstreamer-rtp-0.10 yaml-0.1 libexif gdk-pixbuf-2.0 xf86vidmodeproto gtksourceview-3.0 xtrans mircookie QtScriptTools lapack caca gnome-system-tools damageproto QtDeclarative libpulse hidapi-libusb QtXml expat videoproto cairo-xlib mit-krb5-gssapi libavformat gstreamer-netbuffer-0.10 uuid valgrind banshee-lastfm-gui fontutil xcb-dri2 xcb-dri3 panel swipl gconf-2.0 kbproto randrproto pygoocanvas libxdot openal mobile-broadband-provider-info xrandr libgssglue 'Magick++' dleyna-server-1.0 wayland-egl bash-completion QtGui gdk-2.0 libraw1394 capi20 xcomposite sdl libtasn1 dri2proto QtScript OpenEXR gstreamer-riff-0.10 icu-i18n libgphoto2 datrie-0.2 QtDesigner sm libswresample-ffmpeg cairo-ps p11-kit-1 hexchat-plugin libpulse-mainloop-glib libcdt python gstreamer-check-0.10 gdk-mir-3.0 protobuf-lite python2 mirclient gnome-icon-theme gmodule-2.0 libavcodec ImageMagick gstreamer-dataprotocol-0.10 gdk-pixbuf-xlib-2.0 libdrm_radeon libdrm scrnsaverproto fixesproto SDL2_ttf libpulse-simple slang QtDesignerComponents sqlcipher pango banshee-mono-media m17n-flt geoclue-2.0 libgdiplus m17n-core flac libedit opencv pangoft2 libsodium atspi-2 gobject-introspection-no-export-1.0 gdk-3.0 xorg-sgml-doctools sane-backends compositeproto panelw libbsd-ctor SDL2_image libsystemd xvmc xineramaproto icu-uc libpcre banshee-hyena libpcre16 ginn cairo-xcb-shm libthai javascriptcoregtk-3.0 glproto cairo-pdf gstreamer-sdp-0.10 libevent_openssl pangocairo gstreamer-app-0.10 lcms2 pm-utils gstreamer-0.10 gnome-mime-data-2.0 x11-xcb libpq gthread-2.0 xcb-glx 'gtk+-broadway-3.0' gstreamer-base-0.10 vdpau libssl libusb-1.0 libpcrecpp cairo-xcb IL gl libcrypto gstreamer-plugins-base-0.10 menu QtXmlPatterns Qt3Support MagickWand xorg-wacom mit-krb5 egl intel-gen4asm libdrm_nouveau alsa libspreadsheet-1.12 QtTest cairo-gobject vpx gstreamer-controller-0.10 libxml-2.0 hidapi-hidraw gmodule-no-export-2.0 libdrm_amdgpu bdw-gc x11 libsepol xtst libgvpr gstreamer-fft-0.10 gobject-introspection-1.0 ddjvuapi libevent libpcre32 wayland-client libpathplan QtCLucene QtCore gsl 'gtk+-unix-print-2.0' gstreamer-cdda-0.10 gdk-broadway-3.0 hogweed xmu sndfile mysqlclient poppler-data libexslt wayland-server libsoup-2.4 ibus-table 'gtk+-mir-3.0' xi 'libcrypto++' dleyna-server-service-1.0 banshee-services udev libR ILUT xextproto xt cairo-fc xv glib-2.0 cairo xorg-macros yelp-xsl SDL2_gfx Wand libswscale-ffmpeg gdk-wayland-3.0 icu-io cairo-ft banshee-hyena-data-sqlite xcb-sync banshee-lastfm gio-unix-2.0 MagickCore vorbisfile libswresample libdc1394-2 QtSql glesv2 libavutil-ffmpeg pygtksourceview-2.0 'ncurses++w' xfixes vorbisenc presentproto libquvi-scripts xcb-xfixes xbitmaps libdw 'gtk+-unix-print-3.0' banshee-thickclient tic sdl2 gstreamer-tag-0.10 xinerama SDL2_mixer libbsd-overlay tinfo tomboy-addins epoxy formw libpng m17n-shell usbutils xpm 'gtk+-wayland-3.0' gstreamer-rtsp-0.10 gdk-x11-2.0 blas-netlib xml2po librsvg-2.0 xshmfence xcb-randr IlmBase banshee-musicbrainz freetype2 xext libjpeg libudev libgphoto2_port libtiff-4 xau harfbuzz vorbis ice xdamage cairo-script libselinux fftw3l xkbcomp openssl ILU 'gtk+-2.0' xcb-present ncursesw dleyna-connector-dbus-1.0 fftw3f QtHelp atk icu-le libffi wayland-scanner xxf86vm xkeyboard-config gnome-doc-utils xcb-shape python-2.7 fftw3q harfbuzz-icu libavcodec-ffmpeg pthread-stubs banshee-collection-indexer 'caca++' gdlib xrender gstreamer-net-0.10 banshee-core SDL_ttf icu-lx inputproto 'ImageMagick++' libpng12 banshee-webbrowser xcb-shm xscrnsaver xproto protobuf libmpg123 mircore dbus-glib-1 xcb liblzma libswscale gdk-x11-3.0 libavutil gstreamer-audio-0.10 libpcsclite ogg banshee-hyena-gui gstreamer-video-0.10 ncurses form fontconfig libxfconf-0 dbus-python ruby-2.3 QtUiTools webkitgtk-3.0 cairo-xlib-xrender 'gtk+-3.0' banshee-nowplaying ext2fs harfbuzz-gobject gstreamer-floatcast-0.10 lxappearance zlib xfce4-session-2.0 libnotify com_err 'ncurses++' libcgraph menuw gobject-2.0 m17n-db ruby libotf gio-2.0 QtSvg d3d libgvc xdmcp 'gtk+-x11-2.0' QtNetwork blas notify-python sox libavformat-ffmpeg renderproto libclc
Resolving dependencies...
Warning: solver failed to find a solution:
Could not resolve dependencies:
[__0] trying: data-default-0.7.1.1 (user goal)
[__1] unknown package: data-default-instances-old-locale (dependency of
data-default)
[__1] fail (backjumping, conflict set: data-default,
data-default-instances-old-locale)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: data-default (2),
data-default-instances-old-locale (1)
Trying configure anyway.
Using internal setup method with build-type Simple and args:
["configure","--verbose=2","--ghc","--prefix=/home/hvr/.cabal","--user","--extra-prog-path=/home/hvr/.cabal/bin"]
Using Parsec parser
Configuring data-default-0.7.1.1...
CallStack (from HasCallStack):
  die', called at ./Distribution/Simple/Configure.hs:958:20 in Cabal-2.2.0.0-FGQ6k6zzd10HxtpUMDQKJe:Distribution.Simple.Configure
  configureFinalizedPackage, called at ./Distribution/Simple/Configure.hs:462:12 in Cabal-2.2.0.0-FGQ6k6zzd10HxtpUMDQKJe:Distribution.Simple.Configure
  configure, called at ./Distribution/Simple.hs:596:20 in Cabal-2.2.0.0-FGQ6k6zzd10HxtpUMDQKJe:Distribution.Simple
  confHook, called at ./Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.2.0.0-FGQ6k6zzd10HxtpUMDQKJe:Distribution.Simple.UserHooks
  configureAction, called at ./Distribution/Simple.hs:178:19 in Cabal-2.2.0.0-FGQ6k6zzd10HxtpUMDQKJe:Distribution.Simple
  defaultMainHelper, called at ./Distribution/Simple.hs:120:19 in Cabal-2.2.0.0-FGQ6k6zzd10HxtpUMDQKJe:Distribution.Simple
  defaultMainArgs, called at ./Distribution/Client/SetupWrapper.hs:420:29 in main:Distribution.Client.SetupWrapper
cabal: Encountered missing dependencies:
data-default-class >=0.1.2.0,
data-default-instances-containers -any,
data-default-instances-dlist -any,
data-default-instances-old-locale -any

     792,359,824 bytes allocated in the heap
     378,358,152 bytes copied during GC
      45,241,120 bytes maximum residency (16 sample(s))
       1,635,616 bytes maximum slop
             114 MB total memory in use (0 MB lost due to fragmentation)

                                     Tot time (elapsed)  Avg pause  Max pause
  Gen  0       740 colls,     0 par    0.417s   0.417s     0.0006s    0.0795s
  Gen  1        16 colls,     0 par    0.005s   0.005s     0.0003s    0.0006s

  TASKS: 4 (1 bound, 3 peak workers (3 total), using -N1)

  SPARKS: 0 (0 converted, 0 overflowed, 0 dud, 0 GC'd, 0 fizzled)

  INIT    time    0.001s  (  0.001s elapsed)
  MUT     time    0.351s  (  0.796s elapsed)
  GC      time    0.423s  (  0.422s elapsed)
  EXIT    time    0.005s  (  0.012s elapsed)
  Total   time    0.780s  (  1.230s elapsed)

  Alloc rate    2,256,035,837 bytes per MUT second

  Productivity  45.7% of total user, 65.6% of total elapsed

gc_alloc_block_sync: 0
whitehole_spin: 0
gen[0].sync: 0
gen[1].sync: 0

Nor did cabal-install from master exhibit the issue... (I don't use Nix (yet), so this was the quickest thing I could do).

gbaz commented 6 years ago

Just to confirm, is this cabal-install built against the released ghc 8.4.1?

hvr commented 6 years ago

@gbaz mine wasn't (it was compiled w/ GHC 8.2.2)

...but I just tried w/ cabal HEAD + hackage-security HEAD + ghc-8.4.1

and your suspicion was spot on! Needs more investigation... :-/

/cc @23Skidoo


PS: repro instructions for building cabal HEAD w/ GHC 8.4.1

cabal get -s cabal-install
cd cabal-install
cabal get -s hackage-security
echo "packages: Cabal hackage-security/hackage-security cabal-install" > cabal.project
cabal new-build -w ghc-8.4.1 exe:cabal

PS2: I semi-ruled out libraries other than pretty/template-haskell/ghc-prim/base being at fault by pinnding all other libs down to the same versions, and compiling exe:cabal with GHC 8.2.2 and GHC 8.4.1, which resulted in the former one working.

PS3: So the abnormal heap allocation w/ GHC 8.4.1 occurs in the https://github.com/haskell/cabal/blob/master/cabal-install/Distribution/Client/IndexUtils.hs#L685-L714 loop; but it's not obvious to me where. @bgamari suggests to add cost center/SCCs to figure this one out, or to look at the generated STG.

PS4: I won't be able to continue debugging this for a while; so any help is appreciated if somebody wants to take over!

PS5: This seems to point to a bug in the code generation or optimiser, c.f. https://ghc.haskell.org/trac/ghc/ticket/13930

deepfire commented 6 years ago

@gbaz, confirming, everything, including Cabal/cabal-install built with GHC 8.4.1-release -- as per commit in the issue header.

hvr commented 6 years ago

@23Skidoo I think we should close this one; the code triggering this compiler bug in GHC 8.4.1 was refactored to avoid it (and fwiw, the compiler bug was fixed in GHC 8.4.2 anyway); nor do we need to backport anything afaics