Skip to content
This repository was archived by the owner on Aug 2, 2022. It is now read-only.

please disable multi-threaded linking or port upstream patch for LLVM wasm-ld threadpool deadlock issue #741

Closed
godmar opened this issue Nov 12, 2019 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@godmar
Copy link

godmar commented Nov 12, 2019

A brief follow-up on my note in #123 - eosio.cdt 1.6.1 runs with parallel linking enabled, but there's a deadlock in LLVM's threadpool that doesn't allow the parallel writing of sections and custom sections in the WASM backend. See here for the upstream bug that was fixed in LLVM 8.0.1.

Other projects affected by it have disabled parallel linking, e.g. ziglang disabled parallel linking, see here for their bugfix. You can do the same, or possibly backport their fix - which is just a few lines of code.

I've copied and pasted more details, including a backtrace of when eosio-cpp deadlocks, here

@larryk85
Copy link
Contributor

This is on the radar, we will be moving to LLVM 9 as the backbone next release. This will remove this issue, and hopefully not create new ones.

@godmar
Copy link
Author

godmar commented Nov 21, 2019

This is a really unfortunate issue. I'm right now hitting this reproducibly on a t2.medium EC2 instance (which does have 2 virtual CPUs). Of course, the deadlock occurs if these cores aren't scheduled often enough in the underlying multi-tenant environment, which makes the entire enterprise unpredictable and pretty annoying.

@godmar
Copy link
Author

godmar commented Nov 22, 2019

Here's a work-around that doesn't require patching and rebuilding the cdt:

cd /usr/opt/eosio.cdt/1.6.1/bin
sudo mv wasm-ld wasm-ld.real

then create a file /usr/opt/eosio.cdt/1.6.1/bin/wasm-ld like so:

#!/bin/bash

echo "Running " `dirname $0`/wasm-ld.real --no-threads "$@"
`dirname $0`/wasm-ld.real --no-threads "$@"

Then sudo chmod +x /usr/opt/eosio.cdt/1.6.1/bin/wasm-ld and then use eosio-cpp as before.

@jeffreyssmith2nd
Copy link
Contributor

This should be resolved in develop with #896

josejulio added a commit to josejulio/dao-contracts that referenced this issue Apr 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants