0

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/User1@org1.example.com/msp/keystore/priv_sk'
        clientSignedCert:
          path: 'peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem'
    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.

  • The first error looks like a connectivity problem to your orderer, check it is running, listening on port 7050 and is running on the same machine (as the connection is trying localhost). Check your peer logs for issues for No endorsement plan available. check you have got a channel created with that configured in your caliper configuration – david_k Dec 21 '21 at 18:42
  • The network is communicating normally, I can insert and search data in the chain using smart contracts. Something I noticed is that I adjust the Orderer's IP and in the error it shows localhost in the connection file used by Hyperledger Caliper. Peers are on different machines with different IPs. The problem appears to only occur in writing functions. In smartcontract read functions it works properly. – Rodrigo Passos Dec 21 '21 at 19:31
  • Add connection and network file. – Rodrigo Passos Dec 21 '21 at 19:43
  • Do you mean you can run the test successfully but the errors occur just at the beginning? I got this bug especially using fixed-rate rate control, which is very random – Christopher Dec 22 '21 at 06:40
  • The first errors ocurrs always. The second occurs when I execute tests where the caliper write data on the chain. When caliper only read data from the chain, the tests execute normally no errors. – Rodrigo Passos Dec 22 '21 at 16:12
  • Dude, what is the rate control you using? The first errors occur and the benchmark stopped? Or it continues fine? – Christopher Dec 23 '21 at 03:20
  • Hi Christopher, I´m using Fixed-Load rate control. The benchmark doesn´t stop, it run until the end, but for the writing chaincode function these errors are showed. – Rodrigo Passos Jan 05 '22 at 14:12

2 Answers2

0

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/

david_k
  • 5,843
  • 2
  • 9
  • 16
  • I change the property discover to false, but the errors continue. Now, I receive that no valid responser from the any peers. ```2021.12.22-16:32:35.490 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 valid responses from any peers. Errors: at newEndorsementError ``` – Rodrigo Passos Dec 22 '21 at 16:35
  • You can check your peer logs and chaincode logs (assuming you have some logging) to see what went wrong, but I'm guessing it got as far as sending proposals to the peer which is further than before – david_k Dec 22 '21 at 16:46
  • I have checked the peer log, and the return was this at different lines of log: ``` Err: connection error: desc = "transport: Error while dialing dial tcp 192.169.0.7:11051: connect: connection refused". Reconnecting... error: " > ] [gossip.discovery] InitiateSync -> DEBU 7970c^[[0m No peers to send to, aborting membership sync ``` – Rodrigo Passos Dec 23 '21 at 16:38
  • I need change a Fabric configuration or there something wrong in my caliper configuration? – Rodrigo Passos Dec 23 '21 at 16:41
  • Those errors are not going to be anything wrong with your caliper configuration. Caliper is just a client trying to interact with your network using the details you provided it with. I would suggest you test your network first with a client application to make sure it works as expected before you attempt to benchmark it – david_k Dec 23 '21 at 16:43
  • I don't understand. When I set discovery to false the errors changed. When discovery was true, the read test execute success. If I call smartcontract functions from terminal I can execute all functions from smartcontract. I cant see errors on the network. I'm confused. – Rodrigo Passos Dec 24 '21 at 15:15
  • Sorry, I can't provide any more insight really. Try writing a node client application using your connection profile to try to recreate and make sure you are on the latest fabric 2.2 release. Hyperledger fabric can be really tricky to configure correctly – david_k Dec 24 '21 at 17:03
  • this may also be helpful in explaining the error message you are seeing https://stackoverflow.com/questions/64453132/failed-constructing-descriptor-for-chaincodes – david_k Dec 24 '21 at 17:42
  • I'm using a fabric 2.3.0 version, and set into caliper the last compatible version 2.2. npm install --only=prod @hyperledger/caliper-cli@0.4.2 npx caliper bind --caliper-bind-sut fabric:2.2 It can be a problem? – Rodrigo Passos Dec 28 '21 at 03:24
  • No, the 2.2 node sdk used by caliper (and that is basically what is meant when you specify an sut of fabric:2.2) is compatible with fabric 2.3. You could also select the sut to be fabric 1.4 and it would use 1.4 node sdk and it would still work as 1.4 can still interact with fabric 2.3 – david_k Dec 28 '21 at 10:58
  • Hi David. Thanks for all help that you give me until now. I didn´t solve the problem yet. I try to set the anchor peer for all peers of the network. Do you know how I check if it was created correctly? I executed all commands, and received success from all them, There is any way to check this? I really need set anchor peer to run benchmark is I don´t use Discovery=true? – Rodrigo Passos Jan 08 '22 at 13:42
  • The peer logs should show information about the known anchor peers, also thinking about your connection profile more, as you aren't using discovery you may have to provide the channel information and peers in that channel. Take a look at https://hyperledger.github.io/fabric-sdk-node/release-1.4/tutorial-network-config.html for info on what a static connection profile looks like – david_k Jan 08 '22 at 14:38
0

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.