haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.39k stars 211 forks source link

Thread blocked in an STM transaction #1328

Closed Proximyst closed 5 years ago

Proximyst commented 5 years ago

Hi, I'm an Arch user (relevant neofetch + glibc? https://owo.whats-th.is/5zu65ff.png) and I've installed cabal using the bootstrap script. I then used cabal to install stack, and stack is now trying to install HIE. However, when it gets around to unpacking ghc-tinfo6-8.6.4 (and once even got that and went on to installing but failed with the same error), it errs with thread blocked indefinitely in an STM transaction and error code 1. This is done with stack install.hs. It always manages to download ghc-tinfo6, but it never manages to actually use it. I'm new to Haskell as a whole and for sure don't know much about the ecosystem, so I might be missing something but I'm fairly sure I've been doing it correctly so far.

samuelpilz commented 5 years ago

could you try to run stack build --stack-yaml stack-8.6.4.yaml manually?

fendor commented 5 years ago

Does a normal stack project work? E.g.execute stack new test, will create a test directory with a project. Can you then try to use stack build in the newly created directory? I think this error is stack and arch related. Also, does stack setup succeed?

Last but not least, welcome to haskell!

mb720 commented 5 years ago

I just ran into this on Arch Linux 5.1.16:

/home/mb$ sudo aura -A haskell-ide-engine
[sudo] password for mb: 
aura >>= Determining dependencies...
aura >>= AUR Packages:
haskell-ide-engine

aura >>= Continue? [Y/n] 
aura >>= Building `haskell-ide-engine`...
aura >>= Well, building `haskell-ide-engine` failed.
aura >>= Dumping makepkg output in 3.. 2.. 1..
==> Making package: haskell-ide-engine 0.10.0.0-2 (Thu 11 Jul 2019 11:55:50 AM CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Cloning haskell-ide-engine-0.10.0.0 git repo...
Cloning into bare repository '/var/cache/pacman/pkg/haskell-ide-engine2770/haskell-ide-engine/haskell-ide-engine-0.10.0.0'...
==> Validating source files with md5sums...
    haskell-ide-engine-0.10.0.0 ... Skipped
==> Extracting sources...
  -> Creating working copy of haskell-ide-engine-0.10.0.0 git repo...
Cloning into 'haskell-ide-engine-0.10.0.0'...
done.
Switched to a new branch 'makepkg'
==> Starting prepare()...
Submodule 'submodules/HaRe' (https://github.com/alanz/HaRe.git) registered for path 'submodules/HaRe'
Submodule 'submodules/brittany' (https://github.com/lspitzner/brittany.git) registered for path 'submodules/brittany'
Submodule 'submodules/cabal-helper' (https://github.com/alanz/cabal-helper.git) registered for path 'submodules/cabal-helper'
Submodule 'submodules/ghc-mod' (https://github.com/alanz/ghc-mod.git) registered for path 'submodules/ghc-mod'
Cloning into '/var/cache/pacman/pkg/haskell-ide-engine2770/haskell-ide-engine/src/haskell-ide-engine-0.10.0.0/submodules/HaRe'...
Cloning into '/var/cache/pacman/pkg/haskell-ide-engine2770/haskell-ide-engine/src/haskell-ide-engine-0.10.0.0/submodules/brittany'...
Cloning into '/var/cache/pacman/pkg/haskell-ide-engine2770/haskell-ide-engine/src/haskell-ide-engine-0.10.0.0/submodules/cabal-helper'...
Cloning into '/var/cache/pacman/pkg/haskell-ide-engine2770/haskell-ide-engine/src/haskell-ide-engine-0.10.0.0/submodules/ghc-mod'...
==> Starting build()...
Preparing to install GHC (tinfo6) to an isolated location.
This will not interfere with any system-level installation.
Preparing to download ghc-tinfo6-8.2.2 ...
Already downloaded.
Unpacking GHC into /home/mb/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2.temp/ ...
thread blocked indefinitely in an STM transaction
==> ERROR: A failure occurred in build().
    Aborting...

Submodule path 'submodules/HaRe': checked out 'dfab0004320c28e1aa0331a507a9428952f2c938'
Submodule path 'submodules/brittany': checked out '6c187da8f8166d595f36d6aaf419370283b3d1e9'
Submodule path 'submodules/cabal-helper': checked out 'eafed5e8c1d82b8daa35775b52361132f2e70261'
Submodule path 'submodules/ghc-mod': checked out '43476965b5d715f7fcdadd9e14d5e0c53cdb9385'

aura >>= Would you like to continue anyway? [Y/n] 
samuelpilz commented 5 years ago

This seems to be a problem with stack. Could you try running stack setup anywhere?

mb720 commented 5 years ago

stack setup in a directory with a Stack project produces

stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec

stack setup outside a Stack project:

Writing implicit global project config file to: /home/mb/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-13.27
stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
fendor commented 5 years ago

This seems like a problem with stack, maybe somebody reported this upstream already. Can you try to manually invoke stack install.hs hie-8.2.2 and stack install.hs hie-8.6.5?

mb720 commented 5 years ago

Thanks for your quick responses. Where can I find install.hs?

jneira commented 5 years ago

@mb720 the path where aura downloaded the haskell-ide-engine seems to be /var/cache/pacman/pkg/haskell-ide-engine2770/haskell-ide-engine/src/haskell-ide-engine-0.10.0.0 so the install.hs script should be there

fendor commented 5 years ago

Or clone this repo and execute the command in the top level of this repo

mb720 commented 5 years ago

Thanks @jneira. aura did not keep the code in /var/cache/pacman/pkg/.

I cloned the repo and ran

stack install.hs hie-8.2.2

which resulted in

Unpacking GHC into /home/mb/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.4.temp/ ...
thread blocked indefinitely in an STM transaction

On the other hand, judging from the output of

stack install.hs hie-8.6.5

it built and configured all kinds of packages (e.g., network-uri-2.6.1.0, async-2.2.1). The last messages are

hlint-2.2: copy/register                 
Building all executables for `haskell-ide-engine' once. After a successful build of all of them, only specified executables will be rebuilt.
haskell-ide-engine-0.11.0.0: configure (lib + internal-lib + exe)
haskell-ide-engine-0.11.0.0: build (lib + internal-lib + exe)
haskell-ide-engine-0.11.0.0: copy/register   
Completed 160 action(s).                     
Log files have been written to: /home/mb/extra_repos/haskell-ide-engine/.stack-work/logs/
# stack (for hie-8.6.5)
z-haskell-ide-engine-z-hie-test-utils-0.11.0.0: unregistering (Dependency being unregistered: haskell-ide-engine-0.11.0.0)
haskell-ide-engine-0.11.0.0: unregistering (local file changes: .git/index)
haskell-ide-engine-0.11.0.0: configure (lib + internal-lib + exe)
haskell-ide-engine-0.11.0.0: build (lib + internal-lib + exe)
haskell-ide-engine-0.11.0.0: copy/register
Log files have been written to: /home/mb/extra_repos/haskell-ide-engine/.stack-work/logs/
Copying from /home/mb/extra_repos/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6/lts-13.27/8.6.5/bin/hie to /home/mb/.local/bin/hie
Copying from /home/mb/extra_repos/haskell-ide-engine/.stack-work/install/x86_64-linux-tinfo6/lts-13.27/8.6.5/bin/hie-wrapper to /home/mb/.local/bin/hie-wrapper

Copied executables to /home/mb/.local/bin:
- hie
- hie-wrapper
# stack (for hie-8.6.5)
# stack (for hie-8.6.5)
Build completed in 44m37s

indicating that the build succeeded. :-)


Stack version:

Version 1.9.3.1, Git revision 43ff632b030f50898bff793c9e6c634637ba6001 (6217 commits) x86_6
fendor commented 5 years ago

So, this is a problem upstream, that stack fails to install ghc-8.2.2 on arch linux.

Proximyst commented 5 years ago

For the record, if you install ghc from the static binaries distributed by the Haskell team alongside all the other ghc dependencies, you should be able to compile ghc. Use this new ghc to compile ghc once more, then use the new ghc to compile the rest of the toolchain. This took me on a Ryzen 2600 a bit more than an hour in total (ghc, ghc again, cabal, then use cabal to install stack). Stack will properly download its own GHC as it should.

caioalonso commented 5 years ago

Running sudo stack upgrade fixed it for me on Arch Linux.

samuelpilz commented 5 years ago

It seems that the package for stack on the pacman repository is outdated

fendor commented 5 years ago

What does outdated mean? Do we have to bump our required version for stack? Why does it fail though? What can we do, that this does not happen again?

samuelpilz commented 5 years ago

I guess we have to bump the version to 2.1.1