hyperledger / caliper

A blockchain benchmark framework to measure performance of multiple blockchain solutions https://wiki.hyperledger.org/display/caliper
https://hyperledger.github.io/caliper/
Apache License 2.0
650 stars 402 forks source link

Failed to instantiate chaincodes #165

Closed fooock closed 5 years ago

fooock commented 6 years ago

When I try to run the simple benchmark the next error is thrown:

vagrant@ubuntu-xenial:~$ ./execute-test.sh

> caliper@0.1.0 test /home/vagrant/caliper
> npm run lint && npm run nyc && npm run e2e "simple" "-c" "./benchmark/simple/config.json" "-n" "./benchmark/simple/fabric.json"

> caliper@0.1.0 lint /home/vagrant/caliper
> npx eslint .

> caliper@0.1.0 nyc /home/vagrant/caliper
> nyc mocha --recursive -t 10000

  fixedRate controller implementation
    #init
      ✓ should set the sleep time for a single client if no clients are specified
      ✓ should set the sleep time for a single client
      ✓ should set the sleep time for multiple clients
      ✓ should set the sleep time to zero if 0 tps specified
    #applyRateControl
      ✓ should sleep for the full ammount of time if there is zero elapsed time
      ✓ should reduce the sleep time based on the elapsed time difference
      ✓ should not sleep if the elapsed time difference is below the 5ms threshold
      ✓ should not sleep if the sleepTime is zero

  pidRate controller implementation
    #init
      ✓ should set all gain values from constructor options
      ✓ should set a default sleep if no starting tps is provided
      ✓ should set logging if showVars option is provided
      ✓ should not set logging if no log option is provided
    #applyRateControl
      logging actions
        ✓ should provide logging if log option is set to be true
        ✓ should not provide logging if log option is not set
        ✓ should not provide logging if log option is set to be false
      sleep actions
        ✓ should not modify sleep time if no load error and isolated proportional gain
        ✓ should reduce sleep time if negative load error and isolated proportional gain
        ✓ should increase sleep time if positive load error and isolated proportional gain
        ✓ should not modify sleep time if no integral error and isolated integral gain
        ✓ should reduce sleep time if negative integral error and isolated integral gain
        ✓ should increase sleep time if positive integral error and isolated integral gain
        ✓ should not modify sleep time if no derivative error and isolated derivative gain
        ✓ should reduce sleep time if negative derivative error and isolated derivative gain
        ✓ should increase sleep time if positive derivative error and isolated derivative gain
        ✓ should sleep if above the 5ms threshold
        ✓ should not sleep if below the 5ms threshold

  26 passing (191ms)

=============================== Coverage summary ===============================
Statements   : 5.33% ( 13/244 )
Branches     : 8.7% ( 8/92 )
Functions    : 7.69% ( 3/39 )
Lines        : 5.49% ( 13/237 )
================================================================================

> caliper@0.1.0 e2e /home/vagrant/caliper
> node ./scripts/test.js "simple" "./benchmark/simple/config.json" "./benchmark/simple/fabric.json"

TAP version 13
# #######Caliper Test######
docker-compose -f network/fabric/simplenetwork/docker-compose.yaml up -d
Creating network "simplenetwork_default" with the default driver
Pulling ca (hyperledger/fabric-ca:x86_64-1.1.0)...
x86_64-1.1.0: Pulling from hyperledger/fabric-ca
Digest: sha256:92f44d0811cddb0d335f7879f7e3b3c4b631f31740c76f3e7b85438c244b03f4
Status: Downloaded newer image for hyperledger/fabric-ca:x86_64-1.1.0
Pulling orderer.example.com (hyperledger/fabric-orderer:x86_64-1.1.0)...
x86_64-1.1.0: Pulling from hyperledger/fabric-orderer
Digest: sha256:0c3a3b5ecfd24b513da22bbb77da7b3f5bca9c121cc0ac5c46ba04c97c163654
Status: Downloaded newer image for hyperledger/fabric-orderer:x86_64-1.1.0
Pulling peer (hyperledger/fabric-peer:x86_64-1.1.0)...
x86_64-1.1.0: Pulling from hyperledger/fabric-peer
Digest: sha256:57417699ddf50c5ebd47a9a2cc74c0324fbba0281eb1104b9ddd05a67776b01f
Status: Downloaded newer image for hyperledger/fabric-peer:x86_64-1.1.0
Creating simplenetwork_ca_1   ... done
Creating ca_peerOrg2          ... done
Creating ca_peerOrg1          ... done
Creating simplenetwork_peer_1 ... done
Creating orderer.example.com  ... done
Creating peer1.org1.example.com ... done
Creating peer0.org2.example.com ... done
Creating peer1.org2.example.com ... done
Creating peer0.org1.example.com ... done
# create mychannel......
ok 1 created mychannel successfully
# Sleep 5s......
# Join channel......
# join mychannel
ok 2 Successfully joined mychannel
# install all chaincodes......
info: [packager/Golang.js]: packaging GOLANG from contract/fabric/simple/go
info: [packager/Golang.js]: packaging GOLANG from contract/fabric/simple/go
ok 3 Installed chaincode simple successfully in all peers
# Instantiate chaincode......
error: [Peer.js]: sendProposal - timed out after:120000
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT
    at Timeout._onTimeout (/home/vagrant/caliper/node_modules/fabric-client/lib/Peer.js:124:19)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)
error: [Peer.js]: sendProposal - timed out after:120000
error: [Peer.js]: sendProposal - timed out after:120000
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT
    at Timeout._onTimeout (/home/vagrant/caliper/node_modules/fabric-client/lib/Peer.js:124:19)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT
    at Timeout._onTimeout (/home/vagrant/caliper/node_modules/fabric-client/lib/Peer.js:124:19)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)
error: [Peer.js]: sendProposal - timed out after:120000
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT
    at Timeout._onTimeout (/home/vagrant/caliper/node_modules/fabric-client/lib/Peer.js:124:19)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)
not ok 4 Failed to instantiate chaincodes, Error: Failed to send instantiate due to error: Error: Failed to send instantiate Proposal or receive valid response. Response null or status is not 200. exiting... at Client.newDefaultKeyValueStore.then.then.then.then (/home/vagrant/caliper/src/fabric/e2eUtils.js:372:19) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7) at Client.newDefaultKeyValueStore.then.then.then.then.then (/home/vagrant/caliper/src/fabric/e2eUtils.js:385:15) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7)
  ---
    operator: fail
    at: chaincodes.reduce.then.catch (/home/vagrant/caliper/src/fabric/instantiate-chaincode.js:60:19)
    stack: |-
      Error: Failed to instantiate chaincodes, Error: Failed to send instantiate due to error: Error: Failed to send instantiate Proposal or receive valid response. Response null or status is not 200. exiting...
          at Client.newDefaultKeyValueStore.then.then.then.then (/home/vagrant/caliper/src/fabric/e2eUtils.js:372:19)
          at <anonymous>
          at process._tickCallback (internal/process/next_tick.js:188:7)
          at Client.newDefaultKeyValueStore.then.then.then.then.then (/home/vagrant/caliper/src/fabric/e2eUtils.js:385:15)
          at <anonymous>
          at process._tickCallback (internal/process/next_tick.js:188:7)
          at Test.assert [as _assert] (/home/vagrant/caliper/node_modules/tape/lib/test.js:224:54)
          at Test.bound [as _assert] (/home/vagrant/caliper/node_modules/tape/lib/test.js:76:32)
          at Test.fail (/home/vagrant/caliper/node_modules/tape/lib/test.js:317:10)
          at Test.bound [as fail] (/home/vagrant/caliper/node_modules/tape/lib/test.js:76:32)
          at chaincodes.reduce.then.catch (/home/vagrant/caliper/src/fabric/instantiate-chaincode.js:60:19)
          at <anonymous>
          at process._tickCallback (internal/process/next_tick.js:188:7)
  ...
fabric.installSmartContract() failed, Error: Fabric: instantiate chaincodes failed
    at chaincodes.reduce.then.catch (/home/vagrant/caliper/src/fabric/instantiate-chaincode.js:61:31)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
[Transaction Info] - Submitted: 0 Succ: 0 Fail:0 Unfinished:0
unexpected error, Error: Fabric: instantiate chaincodes failed
    at chaincodes.reduce.then.catch (/home/vagrant/caliper/src/fabric/instantiate-chaincode.js:61:31)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
docker-compose -f network/fabric/simplenetwork/docker-compose.yaml down;docker rm $(docker ps -aq);docker rmi $(docker images dev* -q)
Stopping peer0.org2.example.com ... done
Stopping peer1.org2.example.com ... done
Stopping peer0.org1.example.com ... done
Stopping peer1.org1.example.com ... done
Stopping orderer.example.com    ... done
Stopping ca_peerOrg1            ... done
Stopping ca_peerOrg2            ... done
Stopping simplenetwork_ca_1     ... done
Removing peer0.org2.example.com ... done
Removing peer1.org2.example.com ... done
Removing peer0.org1.example.com ... done
Removing peer1.org1.example.com ... done
Removing orderer.example.com    ... done
Removing simplenetwork_peer_1   ... done
Removing ca_peerOrg1            ... done
Removing ca_peerOrg2            ... done
Removing simplenetwork_ca_1     ... done
Removing network simplenetwork_default
"docker rm" requires at least 1 argument.
See 'docker rm --help'.

Usage:  docker rm [OPTIONS] CONTAINER [CONTAINER...]

Remove one or more containers
"docker rmi" requires at least 1 argument.
See 'docker rmi --help'.

Usage:  docker rmi [OPTIONS] IMAGE [IMAGE...]

Remove one or more images

1..4
# tests 4
# pass  3
# fail  1

Benchmark return code:  1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! caliper@0.1.0 e2e: `node ./scripts/test.js "simple" "./benchmark/simple/config.json" "./benchmark/simple/fabric.json"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the caliper@0.1.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2018-08-20T16_56_38_404Z-debug.log
npm ERR! Test failed.  See above for more details.

I'm running on Ubuntu 16.04. My node and npm versions are:

vagrant@ubuntu-xenial:~$ node --version
v8.10.0
vagrant@ubuntu-xenial:~$ npm --version
5.6.0

And the installed libraries are:

vagrant@ubuntu-xenial:~/caliper$ npm list fabric-client
caliper@0.1.0 /home/vagrant/caliper
├─┬ composer-admin@0.19.0
│ └─┬ composer-connector-hlfv1@0.19.0
│   └── fabric-client@1.1.0  deduped
└── fabric-client@1.1.0

vagrant@ubuntu-xenial:~/caliper$ npm list fabric-ca-client
caliper@0.1.0 /home/vagrant/caliper
├─┬ composer-admin@0.19.0
│ └─┬ composer-connector-hlfv1@0.19.0
│   └── fabric-ca-client@1.1.0  deduped
└── fabric-ca-client@1.1.0

vagrant@ubuntu-xenial:~/caliper$ npm list grpc
caliper@0.1.0 /home/vagrant/caliper
├─┬ fabric-client@1.1.0
│ └── grpc@1.10.1  deduped
└── grpc@1.10.1

Similar issues

118

137

149

Nothing works, any idea what's happening? Thanks!

lzh5261 commented 6 years ago

I meet the same question,"info: [packager/Golang.js]: packaging GOLANG from contract/fabric/simple/go",it means we should install go ? ,but i have installed it , happened yet

nklincoln commented 5 years ago

you appear to be running the build tests (used as part of the travis build) instead of running the actual benchmark locally.

The 'Run benchmark' section in the readme.md indicates how to run the benchmark and not the current test suite.

aklenik commented 5 years ago

@fooock @lzh5261 Issue #137 has additional comments since it was referenced from here. Can you check the suggested approach?

panyu4 commented 5 years ago

@fooock @lzh5261 as our experiences and said in the issue #137 , instantiating chaincode error is caused by the pre-requisites. Since there are lack of some modules, it need to download corresponding packages, meanwhile the time is short which results in the timeout error. So run npm install -g node-gyp node-pre-gyp before you use command node benchmark/simple/main.js to run the simple test.