Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while performing "test" step: Error: Multiple bindings for fabric have been detected, you need to unbind one or more to ensure only a single bind is present to continue #1666

Open
umitkilic opened this issue Nov 28, 2024 · 4 comments
Labels
question Further information is requested User Error

Comments

@umitkilic
Copy link

umitkilic commented Nov 28, 2024

Which Caliper version are you using?

0.6.0

Which Node.JS version are you using?

v20.18.1

Which operating system are you using?

Ubuntu 22.04

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

I was trying to run caliper on my HyperledgerFabric v3.0.0 network. I bind just fabric:2.4 with command but it always says there is a multiple bindings. What is the problem and solution?

What was the observed incorrect behavior?

Caliper says there is multiple bindings and benchmark execution failed with error code 6

Please provide the error logs and their surroundings.

2024.11.28-17:25:37.105 info  [caliper] [cli-launch-manager]    Binding specification is present, performing binding for "fabric:2.4"
2024.11.28-17:25:37.110 warn  [caliper] [bind]  Working directory is not specified. Current path: "/home/umit/Desktop/HLFv3_PHD_UK/benchmarking"
2024.11.28-17:25:37.111 info  [caliper] [bind]  Binding for [email protected]. This might take some time...
2024.11.28-17:25:37.111 info  [caliper] [bind]  Using working directory: /home/umit/Desktop/HLFv3_PHD_UK/benchmarking
2024.11.28-17:25:37.112 info  [caliper] [bind]  Calling npm with: install @hyperledger/[email protected] @grpc/[email protected]

up to date, audited 632 packages in 3s

19 packages are looking for funding
  run `npm fund` for details

48 vulnerabilities (4 low, 8 moderate, 15 high, 21 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
2024.11.28-17:25:41.036 info  [caliper] [cli-launch-manager]    Set workspace path: /home/umit/Desktop/HLFv3_PHD_UK/benchmarking
2024.11.28-17:25:41.037 info  [caliper] [cli-launch-manager]    Set benchmark configuration path: /home/umit/Desktop/HLFv3_PHD_UK/benchmarking/benchmarks/scenario/simple/fabcar/config.yaml
2024.11.28-17:25:41.037 info  [caliper] [cli-launch-manager]    Set network configuration path: /home/umit/Desktop/HLFv3_PHD_UK/benchmarking/networks/fabric/v2.1/network-config_2.1.yaml
2024.11.28-17:25:41.037 info  [caliper] [cli-launch-manager]    Set SUT type: fabric
2024.11.28-17:25:41.046 info  [caliper] [benchmark-validator]   No observer specified, will default to `none`
2024.11.28-17:25:41.046 info  [caliper] [caliper-engine]        Starting benchmark flow
2024.11.28-17:25:41.047 info  [caliper] [caliper-engine]        Skipping start commands due to benchmark flow conditioning
2024.11.28-17:25:41.047 info  [caliper] [caliper-engine]        Skipping initialization phase due to benchmark flow conditioning
2024.11.28-17:25:41.047 info  [caliper] [caliper-engine]        Skipping install smart contract phase due to benchmark flow conditioning
2024.11.28-17:25:42.610 error [caliper] [caliper-engine]        Error while performing "test" step: Error: Multiple bindings for fabric have been detected, you need to unbind one or more to ensure only a single bind is present to continue
    at _determineInstalledNodeSDKandVersion (/home/umit/Desktop/HLFv3_PHD_UK/benchmarking/node_modules/@hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:52:19)
    at CaliperEngine.connectorFactory [as adapterFactory] (/home/umit/Desktop/HLFv3_PHD_UK/benchmarking/node_modules/@hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:132:17)
    at CaliperEngine.run (/home/umit/Desktop/HLFv3_PHD_UK/benchmarking/node_modules/@hyperledger/caliper-core/lib/manager/caliper-engine.js:149:64)
    at LaunchManager.handler (/home/umit/Desktop/HLFv3_PHD_UK/benchmarking/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:81:43)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024.11.28-17:25:42.610 info  [caliper] [caliper-engine]        Skipping end command due to benchmark flow conditioning
2024.11.28-17:25:42.610 error [caliper] [cli-launch-manager]    Benchmark execution failed with error code: 6
Usage:
 caliper launch manager --caliper-bind-sut fabric:2.2 [other options]

Options:
  --help, -h           Show usage information  [boolean]
  --version            Show version information  [boolean]
  --caliper-bind-sut   The name and version of the platform to bind to  [string]
  --caliper-bind-cwd   The working directory for performing the SDK install  [string]
  --caliper-bind-args  Additional arguments to pass to "npm install". Use the "=" notation when setting this parameter  [string]
  --caliper-bind-file  Yaml file to override default (supported) package versions when binding an SDK  [string]

Error: Benchmark execution failed with error code: 6
    at LaunchManager.handler (/home/umit/Desktop/HLFv3_PHD_UK/benchmarking/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:89:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Please provide your benchmark configuration file content, if possible.

test:
  workers:
    type: local
    number: 1
  rounds:
    - label: Query all cars. 
      txDuration: 30  #transaction duration 
      rateControl:
          type: fixed-load
          opts:
            tps: 5 #with  of 5 TPS
      workload:
        module: benchmarks/scenario/simple/fabcar/queryAllCars.js
        arguments:
          assets: 10
          startKey: '1'
          endKey: '50'
    - label: Query a car.
      txDuration: 10
      rateControl:
          type: fixed-load
          opts:
            transactionLoad: 5
      workload:
        module: benchmarks/scenario/simple/fabcar/queryCar.js
        arguments:
          assets: 10
    - label: Create a car.
      txDuration: 30
      rateControl:
          type: fixed-load
          opts:
            transactionLoad: 5
      workload:
        module: benchmarks/scenario/simple/fabcar/createCar.js
monitors:
  resource:
  - module: docker
    options:
      interval: 5 
      containers:
      - all
    charting:
      bar:
        metrics: [Memory(avg), CPU%(avg)]
      polar:
        metrics: [all]
  - module: process
    options:
      interval: 3
      processes: [{ command: 'node', arguments: 'caliper', multiOutput: 'avg' }]
    charting:
      bar:
        metrics: [all]

Please provide your network configuration file content, if possible.

name: Fabric
version: "2.0.0"
mutual-tls:

caliper:
  blockchain: fabric

# info: #comment yapıldı.
#   Version: 2.2.4
#   Size: 2 Orgs with 2 Peer
#   Orderer: Raft
#   Distribution: Single Host
#   StateDB: CouchDB

clients:
  client0.org1.uk.com:
    client:
      organization: Org1
      credentialStore:
        path: /tmp/hfc-kvs/org1
        cryptoStore:
          path: /tmp/hfc-cvs/org1
      clientPrivateKey:
        path: ../crypto-material/peerOrganizations/org1.uk.com/users/[email protected]/msp/keystore/priv_sk
      clientSignedCert:
        path: ../crypto-material/peerOrganizations/org1.uk.com/users/[email protected]/msp/signcerts/[email protected]

channels:
  ukchannel:
    created: true
    orderers:
    - orderer.uk.com
    peers:
      peer0.org1.uk.com:
        eventSource: true
      peer0.org2.uk.com:
       eventSource: true

    contracts:
    - id: fabcar
      version: "1"
      language: golang



organizations:
  Org1:
    mspid: Org1MSP
    peers:
      - peer0.org1.uk.com
    adminPrivateKey:
      path: ../crypto-material/peerOrganizations/org1.uk.com/users/[email protected]/msp/keystore/priv_sk
    signedCert:
      path: ../crypto-material/peerOrganizations/org1.uk.com/users/[email protected]/msp/signcerts/[email protected]

  Org2:
    mspid: Org2MSP
    peers:
      - peer0.org2.uk.com
    adminPrivateKey:
      path: ../crypto-material/peerOrganizations/org2.uk.com/users/[email protected]/msp/keystore/priv_sk
    signedCert:
      path: ../crypto-material/peerOrganizations/org2.uk.com/users/[email protected]/msp/signcerts/[email protected]

orderers:
  orderer0.uk.com:
    url: grpcs://localhost:7050
    grpcOptions:
      ssl-target-name-override: orderer0.uk.com
    tlsCACerts:
      path: ../crypto-material/ordererOrganizations/uk.com/orderers/orderer0.uk.com/tls/ca.crt
 

peers:
  peer0.org1.uk.com:
    url: grpcs://localhost:7051
    grpcOptions:
      ssl-target-name-override: peer0.org1.uk.com
      grpc.keepalive_time_ms: 600000
    tlsCACerts:
      path: ../crypto-material/peerOrganizations/org1.uk.com/peers/peer0.org1.uk.com/tls/ca.crt


  peer0.org2.uk.com:
    url: grpcs://localhost:8051
    grpcOptions:
      ssl-target-name-override: peer0.org2.uk.com
      grpc.keepalive_time_ms: 600000
    tlsCACerts:
      path: ../crypto-material/peerOrganizations/org2.uk.com/peers/peer0.org2.uk.com/tls/ca.crt

Please provide your workload module content, if possible.

No response

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

Under node_modules folder, I have @hyperledger folder and under it, there are four folders (named caliper-cli, caliper-core, caliper-ethereum, caliper-fabric, fabric-gateway, and fabric-protos). The first four folders were downloaded after npm install command. The last two ones were downloaded after I typed npm install --save @hyperledger/fabric-gateway@^1.5.0

Maybe there is something that I overlooked, I unbinded all version by changing version number in caliper unbind --caliper-bind-sut fabric:X.X command. I tried binding only 2.4 but it does not work.

@davidkel
Copy link
Contributor

@umitkilic Have you checked out the caliper tutorial for hyperledger fabric ? It shows how to install caliper and bind to fabric gateway so I would suggest you follow that path
tutorial link: https://hyperledger-caliper.github.io/caliper/v0.6.0/fabric-tutorial/tutorials-fabric-existing/

@umitkilic
Copy link
Author

@umitkilic Have you checked out the caliper tutorial for hyperledger fabric ? It shows how to install caliper and bind to fabric gateway so I would suggest you follow that path tutorial link: https://hyperledger-caliper.github.io/caliper/v0.6.0/fabric-tutorial/tutorials-fabric-existing/

I completely rebuilt the Fabric network and followed the exact same steps as described on the site, but I still get the same error.

@umitkilic
Copy link
Author

I am writing this for those who will encounter this problem in the future. This solution led me to another problem but it does not give this error anymore. The problem is caused by the inability to isolate some files when working with more than one hyperledger fabric version. When I tracked the source of the error, I saw that the fabric-network folder in the node_modules folder caused this error. Because it is not used in Hyperledger Fabric v2.4 and later versions (https://www.npmjs.com/package/fabric-network) and Fabric Gateway needs to be used instead. If you delete the relevant folder or adjust your runtime environment accordingly, this problem will be solved.

@davidkel
Copy link
Contributor

davidkel commented Dec 4, 2024

@umitkilic If you install node modules globally then you will encounter issues if you then use the same node install to run caliper. This is why caliper advocates using npx with local installs of caliper and bindings so you don't store anything globally and in fact this is a better approach overall when using node. Caliper can drive 3 different fabric client sdks, and if it detects more than 1, which one should it use ? For benchmark runs you need to have a consistent setup to ensure benchmarks are comparable. The only time you want benchmarks from different bindings to compare is when comparing the performance of the SDKs themselves and they do perform differently.

@davidkel davidkel added question Further information is requested User Error labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested User Error
Projects
None yet
Development

No branches or pull requests

2 participants