Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

With a large enough contracts set to compile truffle hangs running tests. #1659

Closed
AC0DEM0NK3Y opened this issue Jan 23, 2019 · 10 comments
Closed

Comments

@AC0DEM0NK3Y
Copy link

  • [Yes] I've asked for help in the Truffle Gitter before filing this issue.

Issue

With a large enough contracts set to compile, the profiling check (I believe) to see if re-compilation needs to occur when running a test suite hangs indefinitely on windows 10.
I would guess it is a race condition/thread starvation problem and the profiling threads need to be sent out in chunks with a max threads per chunk value.

Steps to Reproduce

Using truffle 5.0.2 and solc 0.5.2 on windows 10 x64:

  1. Unbox the metacoin example.
  2. Copy the 3 contracts into a folder.
  3. Copy-Paste that folder large amount of times, I did 20 to give 63 contracts to compile.
  4. Run "truffle compile" from a blank slate i.e. no build folder.
  5. Run "truffle test".

Expected Behavior

Truffle recognizes no compilation needs to occur and starts the test suite.

Actual Results

Hangs indefinitely with this output:

PS D:\GitHub\truffle_test> truffle test
Using network 'test'.

Environment

  • Operating System: Win 10 home x64, i7-8700k with 16GB ram.
  • Ethereum client: N/A but I use parity 2.2.7 stable.
  • Truffle version (truffle version): Truffle v5.0.2 (core: 5.0.2)
  • node version (node --version): Node v10.15.0
  • npm version (npm --version): 6.4.1
@AC0DEM0NK3Y
Copy link
Author

Note: if you switch to solc 0.5.3 the above doesn't hang but instead does try to spit out an error message, but the code in truffle-compile module is trying to dereference "e" instead of "err".

Her's the output using solc 0.5.3:

PS D:\GitHub\truffle_test> truffle test
Using network 'test'.

ReferenceError: e is not defined
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:267:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
ReferenceError: e is not defined
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:267:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)
    at async.whilst.fileFinished (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:255:1)
    at next (C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\build\webpack:\~\async\dist\async.js:5223:1)

C:\Users\Admin\AppData\Roaming\nvm\v10.15.0\node_modules\truffle\node_modules\.cache\truffle\soljson-v0.5.3+commit.10d17f24.js:22
(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var __GLOBAL__I_000101=Module["__GLOBAL__I_000101"]=asm["__GLOBAL__I_000101"];var __GLOBAL__sub_I_ABIFunctions_cpp=Module["__GLOBAL__sub_I_ABIFunctions_cpp"]=asm["__GLOBAL__sub_I_ABIFunctions_cpp"];var __GLOBAL__sub_I_ABI_cpp=Module["__GLOBAL__sub_I_ABI_cpp"]=asm["__GLOBAL__sub_I_ABI_cpp"];var __GLOBAL__sub_I_ASTJsonConverter_cpp=Module["__GLOBAL__sub_I_ASTJsonConverter_cpp"]=asm["__GLOBAL__sub_I_ASTJsonConverter_cpp"];var __GLOBAL__sub_I_AST_cpp=Module["__GLOBAL__sub_I_AST_cpp"]=asm["__GLOBAL__sub_I_AST_cpp"];var __GLOBAL__sub_I_ArrayUtils_cpp=Module["__GLOBAL__sub_I_ArrayUtils_cpp"]=asm["__GLOBAL__sub_I_ArrayUtils_cpp"];var __GLOBAL__sub_I_AsmAnalysis_cpp=Module["__GLOBAL__sub_I_AsmAnalysis_cpp"]=asm["__GLOBAL__sub_I_AsmAnalysis_cpp"];var __GLOBAL__sub_I_CompilerContext_cpp=Module["__GLOBAL__sub_I_CompilerContext_cpp"]=asm["__GL
abort({}). Build with -s ASSERTIONS=1 for more info.

@AC0DEM0NK3Y
Copy link
Author

If you can explain how to build/run truffle locally on windows I can perhaps help fix things like this and give you PR's rather than bug descriptions.

@gnidan
Copy link
Contributor

gnidan commented Jan 24, 2019

Do the instructions in the README work for you on Windows? Let me know if they don't and we can get that sorted out.

Thanks a bunch!

@JamesTherien
Copy link

JamesTherien commented Jan 24, 2019

I have the same issue on macOs 10.14.2
A workaround:
truffle test --compile-all
but does more than just compile

@gnidan
Copy link
Contributor

gnidan commented Mar 20, 2019

How about Solidity 0.5.6 and Truffle v5.0.8? Does this change anything? Does the same e undefined exception happen?

@AC0DEM0NK3Y
Copy link
Author

Same problem with 0.5.6 and 5.0.8.

If you add the large number of contracts test to your release testing suite, you should hit it.

@mattcrooks
Copy link

Still seeing the same on 5.0.9

workaround for us by deleting the build/contracts folder and re-compiling

@manmountain
Copy link

I got the same issue with 5.0.13

Truffle v5.0.13 (core: 5.0.13)
Solidity v0.5.0 (solc-js)
Node v8.11.3
Web3.js v1.0.0-beta.37

@AC0DEM0NK3Y
Copy link
Author

AC0DEM0NK3Y commented May 31, 2019

Seems to be OK with the below setup (on Windows):

Truffle v5.0.20 (core: 5.0.20)
Solidity - 0.5.9 (solc-js)
Node v10.15.0
Web3.js v1.0.0-beta.37

But I think this is because it is recompiling every time regardless, see #469 (comment)

@eggplantzzz
Copy link
Contributor

Looks like this is solved!! 🥇 If there is still some problem here, feel free to open another issue! Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants