Tests randomly crashing at ProviderError.ExtendableError on Ubuntu (Linux)
See original GitHub issue- I’ve asked for help in the Truffle Gitter before filing this issue.
Issue
On a Ubuntu Linux environment (Trusty), tests randomly fail with this ExtendableError
:
1) Contract: TopicEvent "after each" hook for "throws on an invalid result index":
Error: Could not connect to your Ethereum client. Please check that your Ethereum client:
- is running
- is accepting RPC connections (i.e., "--rpc" option is used in geth)
- is accessible over the network
- is properly configured in your Truffle configuration file (truffle.js)
at ProviderError.ExtendableError (/home/travis/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:9401:17)
at new ProviderError (/home/travis/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:325054:24)
at /home/travis/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:325137:17
at /home/travis/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:325195:24
at XMLHttpRequest.request.onreadystatechange (/home/travis/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:328229:7)
at XMLHttpRequestEventTarget.dispatchEvent (/home/travis/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:176415:18)
at XMLHttpRequest._setReadyState (/home/travis/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:176705:12)
at XMLHttpRequest._onHttpRequestError (/home/travis/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:176895:12)
at ClientRequest.<anonymous> (/home/travis/.nvm/versions/node/v8.9.3/lib/node_modules/truffle/build/cli.bundled.js:176765:24)
at Socket.socketOnEnd (_http_client.js:423:9)
at endReadableNT (_stream_readable.js:1056:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
Specifically, I have a Travis-CI (continuous integration) setup and this is where the tests are failing. My local Mac OSX environment passes these tests with no problem. Every once and a while, they will fail with the same error, but I just run the tests again and they pass.
I’d say it happens like 10-15% of the time on Mac OSX, but it happens like 60-80% of the time on the Travis-CI linux env.
It feels like it used to have this error less on earlier Truffle versions. I just updated to 4.0.4 and it seems way more often now.
Steps to Reproduce
- Clone this repo: https://github.com/bodhiproject/bodhi-core
- Use Truffle v4.0.4 on a Ubuntu Linux environment (see environment details)
- truffle test
Expected Behavior
Tests should pass like they do on Mac OSX env.
Actual Results
I test this on my local machine (mac osx), when all tests pass which they do, I push up to Github. Then it fires off a Travis-CI test on the linux env and fails pretty much every time.
Environment
Travis-CI Env (fails)
- Operating System: Ubuntu 14.04 Trusty
- Truffle version: 4.0.4
- node version: v8.9.3
- npm version: 5.5.1
- nvm version: 0.33.8
- Build language: node_js
- Build group: stable
- Build dist: trusty
- Distributor ID: Ubuntu
- Description: Ubuntu 14.04.5 LTS
- Release: 14.04
- Codename: trusty
- Compiled with gcc 4.8.2 for Unix (Linux ELF) on Oct 21 2013.
- OS/Arch: linux/amd64
Mac OSX Env (passes)
- Mac OSX 10.12.6 Sierra
- Truffle v4.0.4
- node version: 8.9.1
- npm version: 5.5.1
$ gcc --version:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Issue Analytics
- State:
- Created 6 years ago
- Comments:81 (31 by maintainers)
@benjamincburns Yes, it turns out this originates at web3 and they’re fixing it in
beta.36
.(It was keep-alive - the change).
@cgewecke: I have removed all my root-level hooks, and i’m still encountering disconnections. However, in opposed to before, the errors that I am getting are always
"after each" hook...
. And to be absolutely clear on that, I don’t even have anafterEach
hook in any of my tests! Maybe Mocha adds implicit calls toafterEach
, when an explicit call tobeforeEach
exists in the code. However, so long as these implicit calls are not added at the root-level, it does not support my conjecture of hooked code running in the wrong scope to begin with. In short, I’m at a loss here…By the way, in the code that you linked, there doesn’t seem to be support for the
after
hook, and I am using this hook in my tests.