hyperledger/caliper-benchmarks

Error while performing "init" step: Error: connection not open

0x3N3jVhPUV opened this issue · 9 comments

Which Caliper version are you using?

v0.4.0

Which Node.JS version are you using?

v10

Which operating system are you using?

Ubuntu 20.04 lts

Please provide some context for your error. For example, when did the error occur? What were you trying to achieve, and how?

Hello,
I am new to Hyperledger Caliper and I would like to benchmark my Besu (IBFT2) private network by adding the URL (websocket) of its RPC endpoint, in the networkconfig.json located in networks/ethereum/1node-clique.

What was the observed incorrect behavior?

When I am trying to launch caliper, I’m gettting an error message which indicates that Caliper cannot communicate with my private network.
Logs seem to indicate that Caliper cannot communicate with my private network and I don't understand why since my private network is running.

Please provide the error logs and their surroundings.

Here are the logs: 

2022.02.25-00:22:34.962 error [caliper] [caliper-engine]        Error while performing "init" step: Error: connection not open
2022.02.25-00:22:35.818 error [caliper] [cli-launch-manager]    Benchmark failed with error code 4

Please provide your network configuration file content, if possible.

Here is my networkconfig.json:

{
    "caliper": {
        "blockchain": "ethereum",
        "command" : {
            "start": "sudo docker-compose -f ./networks/besu/1node-clique/docker-compose.yml up -d && sleep 60",
            "end" : "sudo docker-compose -f ./networks/besu/1node-clique/docker-compose.yml down"
          }
    },
    "ethereum": {
        "url": "ws://xx.xxx.xxx.xxx:8546",
        "contractDeployerAddress": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "contractDeployerAddressPrivateKey": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "fromAddressSeed": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "transactionConfirmationBlocks": 2,
        "contracts": {
            "simple": {
                "path": "./src/ethereum/simple/simple.json",
                "estimateGas": true,
                "gas": {
                    "query": 100000,
                    "transfer": 70000
                }
            }
        }
    }
}

Please provide any additional information you deem relevant to the error.

Here are the commands that I’m using:

npm init -y
npm install --only=prod \ @hyperledger/caliper-cli@0.4.0
npx caliper launch manager \
    --caliper-bind-sut besu:latest \
    --caliper-workspace . \
    --caliper-benchconfig benchmarks/scenario/simple/config.yaml \
    --caliper-networkconfig networks/ethereum/1node-clique/networkconfig.json

There is some detail on making the besu artifacts in this repo work, see #172 for more info to see if it helps you

Hello @davidkel,

Thank you very much for your answer!

It working fine with "ws://localhost:8546" !

However, when I reproduce the same steps, in order to benchmark my Besu private network by adding the URL ( "ws://xx.xxx.xxx.xxx:8546") of its RPC endpoint, I get an error code 5. I failed to install smart contract but I don't understand why since the contractDeployerAddress and the contractDeployerAddressPrivateKey that I'm using are coming from the genesis.json of my private network.

Last, I'd like to mention that I didn't merge all commands into a single one.

I wonder what I did wrong.

Here are the logs I get, after running the command to benchmark the simple scenario:

2022.03.03-19:39:42.308 info  [caliper] [ethereum-connector]    Creating contracts...
**2022.03.03-19:41:51.662 error [caliper] [caliper-engine]        Error while performing "install" step: Error: connection not open on send()**
2022.03.03-19:41:51.663 info  [caliper] [caliper-engine]        Executed "install" step in 129.355 seconds
2022.03.03-19:41:51.663 info  [caliper] [caliper-engine]        Skipping end command due to benchmark flow conditioning
**2022.03.03-19:41:51.664 error [caliper] [cli-launch-manager]    Benchmark failed with error code 5**

Here is my networkconfig.yml

{
    "caliper": {
        "blockchain": "ethereum",
        "command" : {
            "start": "sudo docker-compose -f ./networks/besu/1node-clique/docker-compose.yml up -d && sleep 60",
            "end" : "sudo docker-compose -f ./networks/besu/1node-clique/docker-compose.yml down"
          }
    },
    "ethereum": {
        "url": "ws://xx.xxx.xxx.xxx:8546",
        "contractDeployerAddress": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "contractDeployerAddressPrivateKey": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "fromAddressSeed": "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "transactionConfirmationBlocks": 2,
        "contracts": {
            "simple": {
                "path": "./src/ethereum/simple/simple.json",
                "estimateGas": true,
                "gas": {
                    "query": 100000,
                    "transfer": 70000
                }
            }
        }
    }
}

@andyafene I'm not familiar with Besu/Ethereum sorry, have you tested that you can connect on the url provided where caliper runs to eliminate any network issue. A quick google showed this which might help https://gist.github.com/htp/fbce19069187ec1cc486b594104f01d0

Hi @davidkel

I get a HTTP/1.1 200 OK after running this:

curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: xx.xxx.xxx.xxx" -H "Origin: http://xx.xxx.xxx.xxx" http://xx.xxx.xxx.xxx

So, I don't think it's a network issue anymore. Tell me if I'm wrong but otherwise I'd have a error code 4.

However, I get an error code 5.... According to this link, this error happen when you fail to install smart contract.

Thus, since the contractDeployerAddress and the contractDeployerAddressPrivateKey that I'm using are coming from the genesis.json of my private network, why am I getting a error code 5?

@andyafene have you tried not using caliper to deploy your smart contracts ? I've seen other suggestions like that. It could be that the deploy process doesn't work anymore, so just use caliper to test an already deployed setup ?

Hi @davidkel ,

Here is what I get, when I'm trying to skip the smart-contract deployement step by using --caliper-flow-skip-install :

xxxxxxxxxx@CaliperVM:~/caliper-benchmarks$ sudo npx caliper launch manager --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-networkconfig ./networks/besu/1node-clique/networkconfig.json --caliper-workspace . --caliper-flow-skip-install
2022.03.06-18:29:00.982 info  [caliper] [cli-launch-manager]    Set workspace path: /home/xxxxxxxxxxxx/caliper-benchmarks
2022.03.06-18:29:00.983 info  [caliper] [cli-launch-manager]    Set benchmark configuration path: /home/xxxxxxxxxxxx/caliper-benchmarks/benchmarks/scenario/simple/config.yaml
2022.03.06-18:29:00.984 info  [caliper] [cli-launch-manager]    Set network configuration path: /home/xxxxxxxxxxxx/caliper-benchmarks/networks/besu/1node-clique/networkconfig.json
2022.03.06-18:29:00.984 info  [caliper] [cli-launch-manager]    Set SUT type: ethereum
2022.03.06-18:29:01.420 info  [caliper] [benchmark-validator]   No observer specified, will default to `none`
2022.03.06-18:29:01.421 info  [caliper] [caliper-engine]        Starting benchmark flow
2022.03.06-18:29:01.446 info  [caliper] [caliper-utils]         Executing command: cd .; docker-compose -f ./networks/besu/1node-clique/docker-compose.yml up -d && sleep 3
Creating network "1node-clique_default" with the default driver
Creating besu_clique ... done
2022.03.06-18:29:05.643 info  [caliper] [caliper-engine]        Executed start command in 4.197 seconds
2022.03.06-18:29:05.681 info  [caliper] [caliper-engine]        Executed "init" step in 0.037 seconds
**2022.03.06-18:29:05.682 info  [caliper] [caliper-engine]        Skipping install smart contract phase due to benchmark flow conditioning**
2022.03.06-18:29:05.685 info  [caliper] [monitor.js]    No resource monitors specified
2022.03.06-18:29:05.688 info  [caliper] [default-observer]      Observer interval set to 5000 seconds
2022.03.06-18:29:05.694 info  [caliper] [round-orchestrator]    Preparing worker connections
2022.03.06-18:29:05.695 info  [caliper] [worker-orchestrator]   Launching worker 1 of 1
2022.03.06-18:29:05.706 info  [caliper] [worker-orchestrator]   Messenger not configured, entering configure phase...
2022.03.06-18:29:05.707 info  [caliper] [worker-orchestrator]   No existing workers detected, entering worker launch phase...
2022.03.06-18:29:05.708 info  [caliper] [worker-orchestrator]   Waiting for 1 workers to be connected...
2022.03.06-18:29:07.467 info  [caliper] [cli-launch-worker]     Set workspace path: /home/xxxxxxxxxxxx/caliper-benchmarks
2022.03.06-18:29:07.469 info  [caliper] [cli-launch-worker]     Set benchmark configuration path: /home/xxxxxxxxxxxx/caliper-benchmarks/benchmarks/scenario/simple/config.yaml
2022.03.06-18:29:07.469 info  [caliper] [cli-launch-worker]     Set network configuration path: /home/xxxxxxxxxxxx/caliper-benchmarks/networks/besu/1node-clique/networkconfig.json
2022.03.06-18:29:07.471 info  [caliper] [cli-launch-worker]     Set SUT type: ethereum
2022.03.06-18:29:08.360 info  [caliper] [worker-orchestrator]   1 workers connected, progressing to worker assignment phase.
2022.03.06-18:29:08.366 info  [caliper] [worker-orchestrator]   Workers currently unassigned, awaiting index assignment...
2022.03.06-18:29:08.367 info  [caliper] [worker-orchestrator]   Waiting for 1 workers to be assigned...
2022.03.06-18:29:08.501 info  [caliper] [worker-orchestrator]   1 workers assigned, progressing to worker initialization phase.
2022.03.06-18:29:08.502 info  [caliper] [worker-orchestrator]   Waiting for 1 workers to be ready...
2022.03.06-18:29:08.526 info  [caliper] [worker-orchestrator]   1 workers ready, progressing to test preparation phase.
2022.03.06-18:29:08.527 info  [caliper] [round-orchestrator]    Started round 1 (open)
2022.03.06-18:29:08.922 info  [caliper] [worker-message-handler]        Initializing Worker#0...
2022.03.06-18:29:08.922 info  [caliper] [worker-message-handler]        Worker#0 initialized
2022.03.06-18:29:08.926 info  [caliper] [worker-message-handler]        Preparing Worker#0 for Round#0
2022.03.06-18:31:19.458 info  [caliper] [caliper-worker]        Worker [0] encountered an error during prepare test phase for round 0: Error: connection not open on send()
    at Object.ConnectionError (/home/xxxxxxxxxxxx/caliper-benchmarks/node_modules/web3-core-helpers/lib/errors.js:66:23)
    at Object.ConnectionNotOpenError (/home/xxxxxxxxxxxx/caliper-benchmarks/node_modules/web3-core-helpers/lib/errors.js:49:21)
    at /home/xxxxxxxxxxxx/caliper-benchmarks/node_modules/web3-providers-ws/lib/index.js:155:37
    at Map.forEach (<anonymous>)
    at WebsocketProvider._onClose (/home/xxxxxxxxxxxx/caliper-benchmarks/node_modules/web3-providers-ws/lib/index.js:154:27)
    at W3CWebSocket._dispatchEvent [as dispatchEvent] (/home/xxxxxxxxxxxx/caliper-benchmarks/node_modules/yaeti/lib/EventTarget.js:115:12)
    at W3CWebSocket.onConnectFailed (/home/xxxxxxxxxxxx/caliper-benchmarks/node_modules/websocket/lib/W3CWebSocket.js:219:14)
    at WebSocketClient.<anonymous> (/home/xxxxxxxxxxxx/caliper-benchmarks/node_modules/websocket/lib/W3CWebSocket.js:59:25)
    at WebSocketClient.emit (events.js:198:13)
    at ClientRequest.handleRequestError (/home/xxxxxxxxxxxx/caliper-benchmarks/node_modules/websocket/lib/WebSocketClient.js:227:14)
    at ClientRequest.emit (events.js:198:13)
    at Socket.socketErrorListener (_http_client.js:401:9)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
**2022.03.06-18:31:19.459 info  [caliper] [caliper-worker]        Info: worker 0 prepare test phase for round 0 is completed
2022.03.06-18:31:19.459 error [caliper] [worker-message-handler]        Error while handling "prepare" message for Worker (1919441): Error: connection not open on send()**
...

Here is what I get, when I only perform the test phase of the benchmark with --caliper-flow-only-test:

xxxxxxxx@CaliperVM:~/caliper-benchmarks$ sudo npx caliper launch manager --caliper-benchconfig benchmarks/scenario/simple/config.yaml --caliper-networkconfig ./networks/besu/1node-clique/networkconfig.json --caliper-workspace . --caliper-flow-only-test
2022.03.07-01:13:35.893 info  [caliper] [cli-launch-manager]    Set workspace path: /home/xxxxxxxx/caliper-benchmarks
2022.03.07-01:13:35.894 info  [caliper] [cli-launch-manager]    Set benchmark configuration path: /home/xxxxxxxx/caliper-benchmarks/benchmarks/scenario/simple/config.yaml
2022.03.07-01:13:35.894 info  [caliper] [cli-launch-manager]    Set network configuration path: /home/xxxxxxxx/caliper-benchmarks/networks/besu/1node-clique/networkconfig.json
2022.03.07-01:13:35.894 info  [caliper] [cli-launch-manager]    Set SUT type: ethereum
2022.03.07-01:13:36.351 info  [caliper] [benchmark-validator]   No observer specified, will default to `none`
2022.03.07-01:13:36.351 info  [caliper] [caliper-engine]        Starting benchmark flow
2022.03.07-01:13:36.376 info  [caliper] [caliper-engine]        Skipping start commands due to benchmark flow conditioning
2022.03.07-01:13:36.376 info  [caliper] [caliper-engine]        Skipping initialization phase due to benchmark flow conditioning
2022.03.07-01:13:36.377 info  [caliper] [caliper-engine]        Skipping install smart contract phase due to benchmark flow conditioning
2022.03.07-01:13:36.379 info  [caliper] [monitor.js]    No resource monitors specified
2022.03.07-01:13:36.381 info  [caliper] [default-observer]      Observer interval set to 5000 seconds
2022.03.07-01:13:36.384 info  [caliper] [round-orchestrator]    Preparing worker connections
2022.03.07-01:13:36.385 info  [caliper] [worker-orchestrator]   Launching worker 1 of 1
2022.03.07-01:13:36.391 info  [caliper] [worker-orchestrator]   Messenger not configured, entering configure phase...
2022.03.07-01:13:36.392 info  [caliper] [worker-orchestrator]   No existing workers detected, entering worker launch phase...
2022.03.07-01:13:36.392 info  [caliper] [worker-orchestrator]   Waiting for 1 workers to be connected...
2022.03.07-01:13:37.279 info  [caliper] [cli-launch-worker]     Set workspace path: /home/xxxxxxxx/caliper-benchmarks
2022.03.07-01:13:37.281 info  [caliper] [cli-launch-worker]     Set benchmark configuration path: /home/xxxxxxxx/caliper-benchmarks/benchmarks/scenario/simple/config.yaml
2022.03.07-01:13:37.281 info  [caliper] [cli-launch-worker]     Set network configuration path: /home/xxxxxxxx/caliper-benchmarks/networks/besu/1node-clique/networkconfig.json
2022.03.07-01:13:37.281 info  [caliper] [cli-launch-worker]     Set SUT type: ethereum
2022.03.07-01:13:37.809 info  [caliper] [worker-orchestrator]   1 workers connected, progressing to worker assignment phase.
2022.03.07-01:13:37.810 info  [caliper] [worker-orchestrator]   Workers currently unassigned, awaiting index assignment...
2022.03.07-01:13:37.810 info  [caliper] [worker-orchestrator]   Waiting for 1 workers to be assigned...
2022.03.07-01:13:37.861 info  [caliper] [worker-orchestrator]   1 workers assigned, progressing to worker initialization phase.
2022.03.07-01:13:37.862 info  [caliper] [worker-orchestrator]   Waiting for 1 workers to be ready...
2022.03.07-01:13:37.885 info  [caliper] [worker-orchestrator]   1 workers ready, progressing to test preparation phase.
2022.03.07-01:13:37.886 info  [caliper] [round-orchestrator]    Started round 1 (open)
2022.03.07-01:13:38.036 info  [caliper] [worker-message-handler]        Initializing Worker#0...
2022.03.07-01:13:38.036 info  [caliper] [worker-message-handler]        Worker#0 initialized
2022.03.07-01:13:38.036 info  [caliper] [worker-message-handler]        Preparing Worker#0 for Round#0
2022.03.07-01:15:48.258 info  [caliper] [caliper-worker]        Worker [0] encountered an error during prepare test phase for round 0: Error: connection not open on send()

As you can see, I succesfully skipped the smart contract deployement step.
However, in both case, I could not benchmark my SUT, because my workers couldn't connect with my SUT.

So, if a smart contract is not required to benchmark my SUT, why my workers couldn't connect with it?

If the deploy process doesn't work anymore and I have to use caliper to test an already deployed setup, is the smart-contract with wich my workers will interact has to be already deployed on my SUT? Or workers don't even need smart-contract to benchmark my SUT?

If it's the case, how is it possible?

If it's not the case, how should I configure my networkconfig.json ?

Regards,

@andyafene I'm sorry I'm out of suggestions as my expertise is fabric and not ethereum/besu. The only thing I could suggest would be to ask on the besu channel on discord. Caliper currently doesn't have anyone active on besu so I've no-one to suggest to help from a caliper point of view.

Thank you anyway @davidkel ! I really appreciated your help.