commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.98k stars 845 forks source link

Thread blocked indefinitely in an MVar (or STM) operation #4935

Closed erikd closed 5 years ago

erikd commented 5 years ago

General summary/comments (optional)

Steps to reproduce

git clone https://github.com/input-output-hk/cardano-ledger
cd cardano-ledger
stack build

Result in:

thread blocked indefinitely in an MVar operation
thread blocked indefinitely in an STM transaction

Restarting it will get a bit further before hitting the same issue again (and again (and again ...)).

Expected

There should not be any blocked threads.

Actual

$ stack build <args> --verbose
<output>

Stack version

$ stack --version
Version 2.1.1.1, Git revision 45c7a07ea3161f406eb371fbeaf9c553d0806aa1 (4 commits) x86_64

Method of installation

Build from the Hackage tarball and turned into a custom Debian package.

ehildenb commented 5 years ago

I think that https://github.com/haskell/haskell-ide-engine/issues/1328 and I may also be experiencing this. For me, the issue only shows up on my Arch machine, when trying to build https://github.com/kframework/kore. This is on a fresh Arch lxc container which is brought up to date and then has these packages installed:

depends=('java-runtime' 'flex' 'gcc' 'gmp' 'mpfr' 'z3' 'clang' 'libyaml' 'jemalloc' 'opam' 'gawk' 'make' 'diffutils' 'patch' 'tar' 'grep' 'llvm' 'lld')
makedepends=('maven' 'jdk8-openjdk' 'cmake' 'boost' 'zlib' 'stack' 'pkg-config' 'bison' 'python' 'fakeroot')

I run:

$ git clone 'https://github.com/kframework/kore'
Cloning into 'kore'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 35899 (delta 0), reused 4 (delta 0), pack-reused 35892
Receiving objects: 100% (35899/35899), 35.97 MiB | 6.96 MiB/s, done.
Resolving deltas: 100% (21397/21397), done.

$ cd kore

$ stack build
Warning: /home/dev/kore/stack.yaml: Unrecognized fields in PLArchive:github: sha256, size
Preparing to install GHC (tinfo6) to an isolated location.
This will not interfere with any system-level installation.
Already downloaded.                       
Installing GHC ...                                                                  
thread blocked indefinitely in an STM transaction

Retrying doesn't seem to help.

dbaynard commented 5 years ago

Hi, thanks for reporting. Would you please paste the verbose output, @erikd (wrapped in <details> tags, please)?

Likewise, @ehildenb, please paste the verbose output, and I'll take a look.

ehildenb commented 5 years ago

From stack build --verbose:

``` Version 1.9.3.1, Git revision 43ff632b030f50898bff793c9e6c634637ba6001 (6217 commits) x86_64 Compiled with: - Cabal-2.4.0.1 - Glob-0.10.0 - HUnit-1.6.0.0 - QuickCheck-2.13.1 - StateVar-1.1.1.1 - aeson-1.4.4.0 - aeson-compat-0.3.9 - annotated-wl-pprint-0.7.0 - ansi-terminal-0.9.1 - ansi-wl-pprint-0.6.9 - array-0.5.3.0 - asn1-encoding-0.9.5 - asn1-parse-0.9.4 - asn1-types-0.3.3 - async-2.2.2 - attoparsec-0.13.2.2 - attoparsec-iso8601-1.0.1.0 - auto-update-0.1.6 - base-4.12.0.0 - base-compat-0.10.5 - base-orphans-0.8.1 - base-prelude-1.3 - base16-bytestring-0.1.1.6 - base64-bytestring-1.0.0.2 - basement-0.0.11 - bifunctors-5.5.4 - binary-0.8.6.0 - bindings-uname-0.1 - bitarray-0.0.1.1 - blaze-builder-0.4.1.0 - blaze-html-0.9.1.1 - blaze-markup-0.8.2.2 - byteable-0.1.1 - bytestring-0.10.8.2 - call-stack-0.1.0 - case-insensitive-1.2.1.0 - cereal-0.5.8.1 - clock-0.8 - colour-2.3.5 - comonad-5.0.5 - conduit-1.3.1.1 - conduit-extra-1.3.2 - connection-0.3.0 - constraints-0.11 - containers-0.6.0.1 - contravariant-1.5.2 - cookie-0.4.4 - cryptohash-0.11.9 - cryptohash-sha256-0.11.101.0 - cryptonite-0.26 - cryptonite-conduit-0.2.2 - data-default-class-0.1.2.0 - deepseq-1.4.4.0 - digest-0.0.1.2 - directory-1.3.3.0 - distributive-0.6 - dlist-0.8.0.6 - easy-file-0.2.2 - echo-0.1.3 - ed25519-0.0.5.0 - either-5.0.1.1 - enclosed-exceptions-1.0.3 - exceptions-0.10.2 - extra-1.6.17 - fast-logger-2.4.16 - file-embed-0.0.11 - filelock-0.1.1.3 - filepath-1.4.2.1 - free-5.1.1 - fsnotify-0.3.0.1 - generic-deriving-1.12.4 - ghc-boot-th-8.6.5 - ghc-prim-0.5.3 - githash-0.1.3.1 - hackage-security-0.5.3.0 - hashable-1.2.7.0 - hinotify-0.4 - hourglass-0.2.12 - hpack-0.31.2 - hpc-0.6.0.3 - hspec-2.7.1 - hspec-core-2.7.1 - hspec-discover-2.7.1 - hspec-expectations-0.8.2 - hspec-smallcheck-0.5.2 - http-api-data-0.4.1 - http-client-0.6.4 - http-client-tls-0.3.5.3 - http-conduit-2.3.7.1 - http-types-0.12.3 - infer-license-0.2.0 - integer-gmp-1.0.2.0 - integer-logarithms-1.0.3 - libyaml-0.1.1.0 - lifted-async-0.10.0.4 - lifted-base-0.2.3.12 - logict-0.6.0.3 - megaparsec-7.0.5 - memory-0.14.18 - microlens-0.4.11.2 - microlens-th-0.4.3.2 - mime-types-0.1.0.9 - mintty-0.1.2 - monad-control-1.0.2.3 - monad-logger-0.3.30 - monad-loops-0.4.3 - mono-traversable-1.0.11.0 - mtl-2.2.2 - mustache-2.3.0 - neat-interpolation-0.3.2.4 - network-2.8.0.0 - network-uri-2.6.1.0 - old-locale-1.0.0.7 - old-time-1.1.0.3 - open-browser-0.2.1.0 - optparse-applicative-0.14.3.0 - optparse-simple-0.1.1.2 - parsec-3.1.13.0 - parser-combinators-1.0.3 - path-0.6.1 - path-io-1.4.2 - path-pieces-0.2.1 - pem-0.2.4 - persistent-2.9.2 - persistent-sqlite-2.9.3 - persistent-template-2.6.0 - pretty-1.1.3.6 - primitive-0.6.4.0 - process-1.6.5.0 - profunctors-5.4 - project-template-0.2.0.1 - quickcheck-io-0.2.0 - random-1.1 - regex-applicative-0.3.3 - regex-applicative-text-0.1.0.1 - resource-pool-0.2.3.2 - resourcet-1.2.2 - retry-0.8.0.1 - rio-0.1.10.0 - rts-1.0 - safe-0.3.17 - scientific-0.3.6.2 - semigroupoids-5.3.2 - setenv-0.1.1.3 - shelly-1.8.1 - silently-1.2.5 - smallcheck-1.1.5 - socks-0.6.0 - split-0.2.3.3 - splitmix-0.0.2 - stm-2.5.0.0 - stm-chans-3.0.0.4 - store-0.5.1.1 - store-core-0.4.4 - streaming-commons-0.2.1.1 - syb-0.7.1 - system-fileio-0.3.16.4 - system-filepath-0.4.14 - tagged-0.8.6 - tar-0.5.1.0 - template-haskell-2.14.0.0 - temporary-1.3 - text-1.2.3.1 - text-metrics-0.3.0 - tf-random-0.5 - th-abstraction-0.2.11.0 - th-expand-syns-0.4.4.0 - th-lift-0.7.11 - th-lift-instances-0.1.11 - th-orphans-0.13.7 - th-reify-many-0.1.9 - th-utilities-0.2.3.0 - time-1.8.0.2 - time-compat-1.9.2.2 - time-locale-compat-0.1.1.5 - tls-1.4.1 - transformers-0.5.6.2 - transformers-base-0.4.5.2 - transformers-compat-0.6.5 - typed-process-0.2.6.0 - unicode-transforms-0.3.6 - unix-2.7.2.2 - unix-compat-0.5.1 - unix-time-0.4.7 - unliftio-0.2.12 - unliftio-core-0.1.2.0 - unordered-containers-0.2.10.0 - uuid-types-1.0.3 - vector-0.12.0.3 - vector-algorithms-0.8.0.1 - void-0.7.3 - x509-1.7.5 - x509-store-1.6.7 - x509-system-1.6.6 - x509-validation-1.6.11 - yaml-0.11.1.0 - zip-archive-0.4.1 - zlib-0.6.2 Warning: this is an unsupported build that may use different versions of dependencies and GHC than the officially released binaries, and therefore may not behave identically. If you encounter problems, please try the latest official build by running 'stack upgrade --force-download'. 2019-07-16 00:45:54.024184: [debug] Checking for project config at: /home/dev/kore/stack.yaml 2019-07-16 00:45:54.024387: [debug] Loading project config file stack.yaml 2019-07-16 00:45:54.024849: [warn] Warning: /home/dev/kore/stack.yaml: Unrecognized fields in PLArchive:github: sha256, size 2019-07-16 00:45:54.025407: [debug] Decoding build plan from: /home/dev/.stack/build-plan/lts-13.22.yaml 2019-07-16 00:45:54.025441: [debug] Trying to decode /home/dev/.stack/build-plan-cache/lts-13.22.cache 2019-07-16 00:45:54.029963: [debug] Success decoding /home/dev/.stack/build-plan-cache/lts-13.22.cache 2019-07-16 00:45:54.030232: [debug] Run process: /sbin/ldconfig -p 2019-07-16 00:45:54.031426: [debug] Process finished in 1ms: /sbin/ldconfig -p 2019-07-16 00:45:54.032181: [debug] Did not find shared library libtinfo.so.5 2019-07-16 00:45:54.032229: [debug] Found shared library libtinfo.so.6 in /usr/lib 2019-07-16 00:45:54.032255: [debug] Found shared library libncursesw.so.6 in 'ldconfig -p' output 2019-07-16 00:45:54.032281: [debug] Found shared library libgmp.so.10 in 'ldconfig -p' output 2019-07-16 00:45:54.032321: [debug] Did not find shared library libgmp.so.3 2019-07-16 00:45:54.032341: [debug] Potential GHC builds: tinfo6, ncurses6 2019-07-16 00:45:54.032375: [debug] Found already installed GHC builds: 2019-07-16 00:45:54.264198: [debug] Trying to setup GHC build: tinfo6 2019-07-16 00:45:54.264335: [info] Preparing to install GHC (tinfo6) to an isolated location. 2019-07-16 00:45:54.264380: [info] This will not interfere with any system-level installation. 2019-07-16 00:45:54.265091: [info] Preparing to download ghc-tinfo6-8.6.5 ... 2019-07-16 00:45:54.265148: [debug] Downloading from https://github.com/commercialhaskell/ghc/releases/download/ghc-8.6.5-release/ghc-8.6.5-x86_64-fedora27-linux.tar.xz to /home/dev/.stack/programs/x86_64-linux/ghc 2019-07-16 00:45:54.265188: [debug] Will check against sha1 hash: 0b5b1b15dd36edf01eb29fadbb8566864f95838f 2019-07-16 00:45:54.265229: [debug] Will check against sha256 hash: cf78b53eaf336083e7a05f4a3000afbae4abe5bbc77ef80cc40e09d04ac5b4a1 2019-07-16 00:45:55.197113: [info] Already downloaded. 2019-07-16 00:45:55.227219: [debug] menv = fromList [("BROWSER","w3m"),("DBUS_SESSION_BUS_ADDRESS","unix:path=/run/user/1000/bus"),("DOTFILES","/home/dev/dotfiles"),("DOWNLOADS","/home/dev/dl"),("EDITOR","kak"),("E 2019-07-16 00:45:55.227647: [debug] ziptool: xz 2019-07-16 00:45:55.227673: [debug] make: make 2019-07-16 00:45:55.227691: [debug] tar: tar 2019-07-16 00:45:55.227711: [info] Unpacking GHC into /home/dev/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5.temp/ ... 2019-07-16 00:45:55.227730: [debug] Unpacking /home/dev/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5.tar.xz 2019-07-16 00:45:55.227863: [debug] Run process within /home/dev/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5.temp/: /usr/bin/tar Jxf /home/dev/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5.tar.xz thread blocked indefinitely in an STM transaction ```
ehildenb commented 5 years ago

Hmmm, sudo stack upgrade (to version 2.1.3) and now I can run stack build. Makes it tough to make a PKGBUILD though with the default version of stack that Arch comes with.

dbaynard commented 5 years ago

I've flagged it on the aur — glad you've found a fix.

There have been some tar issues, recently (commercialhaskell/stack#4888) and I wonder whether this is related — I'll wait to see what @erikd reports.

erikd commented 5 years ago

I switched back to version 1.9.3 when I hit this issue and have not bothered to update since.

The version I had issue with (2.1.1.1) has been superseded and I will assume that this has been fixed. Closing this.