Rodrigo Passos
Rodrigo Passos

Reputation: 55

Error using framework hyperledger caliper

I have two test tests, one reading and one writing on the blockchain. I'm getting two different errors, one at the start of the test and one at the writing test. The reading test is working normally without problems.

Initial error:

2021.12.21-16:43:01.870 info  [caliper] [round-orchestrator]    Preparing worker connections
2021.12.21-16:43:01.870 info  [caliper] [worker-orchestrator]   Launching worker 1 of 2
2021.12.21-16:43:01.878 info  [caliper] [worker-orchestrator]   Launching worker 2 of 2
2021.12.21-16:43:01.884 info  [caliper] [worker-orchestrator]   Messenger not configured, entering configure phase...
2021.12.21-16:43:01.885 info  [caliper] [worker-orchestrator]   No existing workers detected, entering worker launch phase...
2021.12.21-16:43:01.885 info  [caliper] [worker-orchestrator]   Waiting for 2 workers to be connected...
2021.12.21-16:43:02.426 info  [caliper] [cli-launch-worker]     Set workspace path: /home/ubuntu/caliper/caliper-benchmarks/monitor
2021.12.21-16:43:02.427 info  [caliper] [cli-launch-worker]     Set benchmark configuration path: /home/ubuntu/caliper/caliper-benchmarks/monitor/config.yaml
2021.12.21-16:43:02.427 info  [caliper] [cli-launch-worker]     Set network configuration path: /home/ubuntu/caliper/caliper-benchmarks/monitor/network.yaml
2021.12.21-16:43:02.427 info  [caliper] [cli-launch-worker]     Set SUT type: fabric
2021.12.21-16:43:02.444 info  [caliper] [cli-launch-worker]     Set workspace path: /home/ubuntu/caliper/caliper-benchmarks/monitor
2021.12.21-16:43:02.446 info  [caliper] [cli-launch-worker]     Set benchmark configuration path: /home/ubuntu/caliper/caliper-benchmarks/monitor/config.yaml
2021.12.21-16:43:02.446 info  [caliper] [cli-launch-worker]     Set network configuration path: /home/ubuntu/caliper/caliper-benchmarks/monitor/network.yaml
2021.12.21-16:43:02.447 info  [caliper] [cli-launch-worker]     Set SUT type: fabric
2021.12.21-16:43:02.505 info  [caliper] [worker-orchestrator]   2 workers connected, progressing to worker assignment phase.
2021.12.21-16:43:02.505 info  [caliper] [worker-orchestrator]   Workers currently unassigned, awaiting index assignment...
2021.12.21-16:43:02.506 info  [caliper] [worker-orchestrator]   Waiting for 2 workers to be assigned...
2021.12.21-16:43:02.559 info  [caliper] [worker-orchestrator]   2 workers assigned, progressing to worker initialization phase.
2021.12.21-16:43:02.560 info  [caliper] [worker-orchestrator]   Waiting for 2 workers to be ready...
2021.12.21-16:43:03.629 info  [caliper] [worker-message-handler]        Initializing Worker#1...
2021.12.21-16:43:03.629 info  [caliper] [fabric-connector]      Initializing gateway connector compatible with installed SDK: 2.2.3
2021.12.21-16:43:03.629 info  [caliper] [IdentityManager]       Adding User1 (admin=false) as User1 for organization Org1MSP
2021.12.21-16:43:03.629 info  [caliper] [worker-message-handler]        Worker#1 initialized
2021.12.21-16:43:03.683 info  [caliper] [worker-orchestrator]   2 workers ready, progressing to test preparation phase.
2021.12.21-16:43:03.684 info  [caliper] [round-orchestrator]    Started round 1 (Set)
2021.12.21-16:43:03.690 info  [caliper] [worker-message-handler]        Preparing Worker#1 for Round#0
2021.12.21-16:43:03.696 info  [caliper] [connectors/v2/FabricGateway]   Connecting user with identity User1 to a Network Gateway
2021.12.21-16:43:04.005 info  [caliper] [worker-message-handler]        Initializing Worker#0...
2021.12.21-16:43:04.005 info  [caliper] [fabric-connector]      Initializing gateway connector compatible with installed SDK: 2.2.3
2021.12.21-16:43:04.005 info  [caliper] [IdentityManager]       Adding User1 (admin=false) as User1 for organization Org1MSP
2021.12.21-16:43:04.005 info  [caliper] [worker-message-handler]        Worker#0 initialized
2021.12.21-16:43:04.006 info  [caliper] [worker-message-handler]        Preparing Worker#0 for Round#0
2021.12.21-16:43:04.006 info  [caliper] [connectors/v2/FabricGateway]   Connecting user with identity User1 to a Network Gateway
2021.12.21-16:43:04.007 info  [caliper] [connectors/v2/FabricGateway]   Successfully connected user with identity User1 to a Network Gateway
2021.12.21-16:43:04.008 info  [caliper] [connectors/v2/FabricGateway]   Generating contract map for user User1
2021.12.21-16:43:04.018 info  [caliper] [connectors/v2/FabricGateway]   Successfully connected user with identity User1 to a Network Gateway
2021.12.21-16:43:04.019 info  [caliper] [connectors/v2/FabricGateway]   Generating contract map for user User1
2021-12-21T16:43:07.083Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpc://localhost:7050, connected:false, connectAttempted:true
2021-12-21T16:43:07.086Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer.example.com:7050 url:grpc://localhost:7050 timeout:3000
2021-12-21T16:43:07.088Z - error: [DiscoveryService]: _buildOrderer[channelall] - Unable to connect to the discovered orderer orderer.example.com:7050 due to Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpc://localhost:7050, connected:false, connectAttempted:true
2021-12-21T16:43:07.085Z - error: [ServiceEndpoint]: Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpc://localhost:7050, connected:false, connectAttempted:true
2021-12-21T16:43:07.090Z - error: [ServiceEndpoint]: waitForReady - Failed to connect to remote gRPC server orderer.example.com:7050 url:grpc://localhost:7050 timeout:3000
2021-12-21T16:43:07.092Z - error: [DiscoveryService]: _buildOrderer[channelall] - Unable to connect to the discovered orderer orderer.example.com:7050 due to Error: Failed to connect before the deadline on Committer- name: orderer.example.com:7050, url:grpc://localhost:7050, connected:false, connectAttempted:true

The second error that occurs in the writing test is the following:

2021.12.21-16:43:07.112 info  [caliper] [worker-orchestrator]   2 workers prepared, progressing to test phase.
2021.12.21-16:43:07.112 info  [caliper] [round-orchestrator]    Monitors successfully started
2021.12.21-16:43:07.115 info  [caliper] [worker-message-handler]        Worker#1 is starting Round#0
2021.12.21-16:43:07.116 info  [caliper] [worker-message-handler]        Worker#0 is starting Round#0
2021.12.21-16:43:07.123 info  [caliper] [caliper-worker]        Worker #1 starting workload loop
2021.12.21-16:43:07.126 info  [caliper] [caliper-worker]        Worker #0 starting workload loop
2021.12.21-16:43:07.941 error [caliper] [connectors/v2/FabricGateway]   Failed to perform submit transaction [set] using arguments [node1,{'CPU':50,'MEM':50,'STG':50.0,'DAT':'2020-11-17T00:10:00Z'}],  with error: Error: No endorsement plan available
    at DiscoveryHandler.endorse (/home/ubuntu/caliper/node_modules/fabric-network/node_modules/fabric-common/lib/DiscoveryHandler.js:208:10)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Connection File

---
name: fabric
version: 2.0.0
client:
  organization: Org1
  connection:
    timeout:
      peer:
        endorser: '300'
organizations:
  Org1:
    mspid: Org1MSP
    peers:
    - peer0.org1.example.com
    certificateAuthorities:
    - ca.org1.example.com
orderers:
  orderer.example.com:
    url: grpc://192.169.0.9:7050
    grpcOptions:
      ssl-target-name-override: orderer.example.com
peers:
  peer0.org1.example.com:
    url: grpc://192.169.0.7:7051
    tlsCACerts:
      path: peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
    grpcOptions:
      ssl-target-name-override: peer0.org1.example.com
certificateAuthorities:
  ca.org1.example.com:
    url: https://192.169.0.7:7054
    caName: ca-org1
    tlsCACerts:
      path: peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
    httpOptions:
      verify: false

Network File

name: Fabric
version: '2.0.0'
caliper:
   blockchain: fabric
   sutOptions:
     mutualTls: false
organizations:
  - mspid: Org1MSP
    identities:
      certificates:
      - name: 'User1'
        clientPrivateKey:
          path: 'peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv_sk'
        clientSignedCert:
          path: 'peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]'
    connectionProfile:
      path: 'connection_files/connection-org1.yaml'
      discover: true
orderers:
    orderer.example.com:
        url: grpc://192.169.0.9:7050
        grpcOptions:
            ssl-target-name-override: orderer.example.com
channels:
  - channelName: channelall
    contracts:
    - id: monitor

I kindly ask for any tips so that I can solve these problems and follow the development.

Upvotes: 0

Views: 867

Answers (2)

Rodrigo Passos
Rodrigo Passos

Reputation: 55

The issue was in the connection file.

The old file was:

---
name: fabric
version: 2.0.0
client:
  organization: Org1
  connection:
    timeout:
      peer:
        endorser: '300'
      orderer: '10000'
organizations:
  Org1:
    mspid: Org1MSP
    peers:
    - peer0.org1.example.com
    certificateAuthorities:
    - ca.org1.example.com
orderers:
  orderer.example.com:
    url: grpc://192.169.0.9:7050
    grpcOptions:
      ssl-target-name-override: orderer.example.com
peers:
  peer0.org1.example.com:
    url: grpc://192.169.0.7:7051
    tlsCACerts:
      path: crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
    grpcOptions:
      ssl-target-name-override: peer0.org1.example.com
certificateAuthorities:
  ca.org1.example.com:
    url: http://192.169.0.7:7054
    caName: ca-org1
    tlsCACerts:
      path: crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
    httpOptions:
      verify: false

The new connection file that I created is this:

---
name: fabric
description: "Sample connection profile for documentation topic"
version: 2.0.0
channels:
  channelall:
    orderers:
      - orderer.example.com
    peers:
      peer0.org1.example.com:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
  
      peer0.org2.example.com:
        endorsingPeer: true
        chaincodeQuery: true
        ledgerQuery: true
        eventSource: true
    
      peer0.org3.example.com:
        endorsingPeer: false
        chaincodeQuery: false
        ledgerQuery: true
        eventSource: true
organizations:
  Org1:
    mspid: Org1MSP
    peers:
      - peer0.org1.example.com
  Org2:
    mspid: Org2MSP
    peers:
      - peer0.org2.example.com
  Org3:
    mspid: Org3MSP
    peers:
      - peer0.org3.example.com
orderers:
  orderer.example.com: 
    url: grpc://192.169.0.9:7050  
    grpcOptions:
      ssl-target-name-override: orderer.example.com
peers:
  peer0.org1.example.com:
    url: grpc://192.169.0.7:7051
    grpcOptions:
      ssl-target-name-override: peer0.org1.example.com
      request-timeout: 120001 
  peer0.org2.example.com:
    url: grpc://192.169.0.10:7051
    grpcOptions:
      ssl-target-name-override: peer0.org2.example.com
      request-timeout: 120001 
  peer0.org3.example.com:
    url: grpc://192.169.0.11:7051
    grpcOptions:
      ssl-target-name-override: peer0.org3.example.com
      request-timeout: 120001

With all information about peers and orderers.

Thanks everybody for the help.

Upvotes: 0

david_k
david_k

Reputation: 5868

From the network file you posted a couple of points

  1. you can't define any nodes in it (for example you've added orderers). They are ignored
  2. you've specified that your connection profile is a dynamic profile by setting discover to true in your network file, this means it will use discovery to determine the network topology and may not use the nodes you have explicitly defined in your connection profile. If you want to be explicit in your connection profile (and thus define a static connection profile) like you have in your above example, you should set discover to false, which hopefully will solve your problem.

As a side note, if you use discovery then the node-sdk (used by caliper) and caliper by default converts all discovered node hosts to localhost, which is why you see it trying to contact localhost. To disable this see Runtime settings in https://hyperledger.github.io/caliper/v0.4.2/fabric-config/new/

Upvotes: 0

Related Questions