caliper icon indicating copy to clipboard operation
caliper copied to clipboard

disable caliper-fabric-gateway-enabled in 4.2 version

Open SamYuan1990 opened this issue 3 years ago • 13 comments

Which Caliper version are you using?

0.4.2

Which Node.JS version are you using?

docker

Which operating system are you using?

docker

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

when I try to start caliper in k8s as

      containers:
      - name: main
        image: hyperledger/caliper:0.4.2
        env:
          - name: CALIPER_BIND_SUT
            value: fabric:2.2
          - name: CALIPER_BENCHCONFIG
            value: /tmp/myAssetBenchmark.yaml
          - name: CALIPER_NETWORKCONFIG
            value: /tmp/networkConfig.yaml 

caliper starts fail with old configuration.(before gateway)

What was the observed incorrect behavior?

I am not sure... if we are developing caliper 0.5+ version, then why it blocking 0.4.2 with gateway option and it enabled by default. I tried 0.4.1 and others even 1.4 won't works.

Please provide the error logs and their surroundings.

2022.03.13-08:10:29.118 error [caliper] [cli-launch-manager] 	Unexpected error during benchmark execution: Error: Caliper currently only supports gateway based operation using the 2.2.3 Fabric-SDK. Please retry with the gateway flag
Usage:
 caliper launch manager --caliper-bind-sut fabric:1.4 [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: Caliper currently only supports gateway based operation using the 2.2.3 Fabric-SDK. Please retry with the gateway flag
    at _loadAppropriateConnectorClass (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-cli/node_modules/@hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:79:19)
    at CaliperEngine.connectorFactory [as adapterFactory] (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-cli/node_modules/@hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:122:62)
    at CaliperEngine.run (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-core/lib/manager/caliper-engine.js:93:36)
    at Function.handler (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:62:43)
    at process._tickCallback (internal/process/next_tick.js:68:7)


### Please provide your benchmark configuration file content, if possible.

_No response_

### Please provide your network configuration file content, if possible.

_No response_

### Please provide your workload module content, if possible.

_No response_

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

are we able to roll back the tag to a stable version?

SamYuan1990 avatar Mar 13 '22 08:03 SamYuan1990

I hope before we migrate caliper with gateway approach, there is a stable version for caliper able to be use.

SamYuan1990 avatar Mar 13 '22 08:03 SamYuan1990

@SamYuan1990 for caliper 0.5.0 the need to specify --caliper-fabric-gateway-enabled has been removed when using fabric SUT 2.2 as it's unnecessary (I presume that there was a plan to try to write a connector that used the fabric-common package for 2.2 but it was never done). It is still available in the 1.4 SUT because if you don't specify it, it will use the fabric-client apis and if you do specify it, it will use the fabric-network apis.

If you want to try, then you can use the latest docker and npm builds of 0.5.0 (although listed as unstable, I would say they are a better version to use than 0.4.2)

davidkel avatar Mar 13 '22 09:03 davidkel

022.03.13-10:14:06.143 info  [caliper] [cli-launch-manager] 	Binding specification is present, performing binding for "fabric:1.4"
2022.03.13-10:14:06.147 warn  [caliper] [bind] 	Working directory not specified. Using "/hyperledger/caliper/workspace"
2022.03.13-10:14:06.148 info  [caliper] [bind] 	User-provided arguments for npm: "-g"
2022.03.13-10:14:06.148 info  [caliper] [bind] 	Binding for [email protected]. This might take some time...
2022.03.13-10:14:06.148 info  [caliper] [bind] 	Using working directory: /hyperledger/caliper/workspace
2022.03.13-10:14:06.148 info  [caliper] [bind] 	Calling npm with: install -g [email protected] [email protected] [email protected] [email protected]
npm WARN deprecated [email protected]: This library will not receive further updates other than security fixes. We recommend using @grpc/grpc-js instead.
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This package is no longer maintained.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: This library will not receive further updates other than security fixes. We recommend using @grpc/grpc-js instead.
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^10.15.3 || ^12.15.0","npm":" ^6.4.1"} (current: {"node":"14.19.0","npm":"6.14.16"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^10.15.3 || ^12.15.0","npm":"^6.4.1"} (current: {"node":"14.19.0","npm":"6.14.16"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^8.9.0 || ^10.15.3 || ^12.13.1","npm":"^5.5.1 || ^6.4.1"} (current: {"node":"14.19.0","npm":"6.14.16"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^10.15.3 || ^12.15.0","npm":"^6.4.1"} (current: {"node":"14.19.0","npm":"6.14.16"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^10.15.3 || ^12.15.0","npm":"^6.4.1"} (current: {"node":"14.19.0","npm":"6.14.16"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

npm ERR! code EROFS
npm ERR! syscall mkdir
npm ERR! path /tmp/npm-17-0efbf6ad
npm ERR! errno -30
npm ERR! rofs EROFS: read-only file system, mkdir '/tmp/npm-17-0efbf6ad'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2022-03-13T10_18_44_396Z-debug.log
2022.03.13-10:18:44.425 error [caliper] [bind] 	Failed to execute "npm" with return code 226.
Usage:
 caliper launch manager --caliper-bind-sut fabric:1.4 [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: Failed to execute "npm" with return code 226.
    at ChildProcess.<anonymous> (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-core/lib/common/utils/caliper-utils.js:456:35)
    at ChildProcess.emit (events.js:400:28)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)

with

      - name: main
        image: hyperledger/caliper:0.5.0-unstable-20220311182403
        env:
          - name: CALIPER_BENCHCONFIG
            value: /tmp/myAssetBenchmark.yaml
          - name: CALIPER_NETWORKCONFIG
            value: /tmp/networkConfig.yaml 
        command:
          #- ls
          #- /tmp
          - caliper
          - launch
          - manager
          - --caliper-bind-sut 
          - fabric:1.4

SamYuan1990 avatar Mar 13 '22 10:03 SamYuan1990

2022.03.13-10:19:56.334 info  [caliper] [cli-launch-manager] 	Set workspace path: /hyperledger/caliper/workspace
2022.03.13-10:19:56.336 info  [caliper] [cli-launch-manager] 	Set benchmark configuration path: /tmp/myAssetBenchmark.yaml
2022.03.13-10:19:56.336 info  [caliper] [cli-launch-manager] 	Set network configuration path: /tmp/networkConfig.yaml
2022.03.13-10:19:56.336 info  [caliper] [cli-launch-manager] 	Set SUT type: fabric
2022.03.13-10:19:56.343 info  [caliper] [benchmark-validator] 	No observer specified, will default to `none`
2022.03.13-10:19:56.344 info  [caliper] [caliper-engine] 	Starting benchmark flow
2022.03.13-10:19:56.344 info  [caliper] [caliper-engine] 	Network configuration attribute "caliper.command.start" is not present, skipping start command
2022.03.13-10:19:56.382 error [caliper] [caliper-engine] 	Error while performing "test" step: Error: Unable to detect required Fabric binding packages
    at _determineInstalledNodeSDKVersion (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-cli/node_modules/@hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:39:15)
    at CaliperEngine.connectorFactory [as adapterFactory] (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-cli/node_modules/@hyperledger/caliper-fabric/lib/FabricConnectorFactory.js:98:37)
    at CaliperEngine.run (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-core/lib/manager/caliper-engine.js:109:64)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Function.handler (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:62:30)
2022.03.13-10:19:56.383 info  [caliper] [caliper-engine] 	Network configuration attribute "caliper.command.end" is not present, skipping end command
2022.03.13-10:19:56.383 error [caliper] [cli-launch-manager] 	Benchmark failed with error code 6
Usage:
 caliper launch manager --caliper-bind-sut fabric:1.4 [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 failed with error code 6
    at Function.handler (/home/node/.npm-global/lib/node_modules/@hyperledger/caliper-cli/lib/launch/lib/launchManager.js:70:23)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

with

 - name: main
        image: hyperledger/caliper:0.5.0-unstable-20220311182403
        env:
          - name: CALIPER_BENCHCONFIG
            value: /tmp/myAssetBenchmark.yaml
          - name: CALIPER_NETWORKCONFIG
            value: /tmp/networkConfig.yaml 
        command:
          #- ls
          #- /tmp
          - caliper
          - launch
          - manager

SamYuan1990 avatar Mar 13 '22 10:03 SamYuan1990

kubectl logs -f caliper-5cc457d95d-wh5cb      -c main
2022.03.13-10:22:46.112 info  [caliper] [cli-launch-manager] 	Binding specification is present, performing binding for "fabric:2.2"
2022.03.13-10:22:46.116 warn  [caliper] [bind] 	Working directory not specified. Using "/hyperledger/caliper/workspace"
2022.03.13-10:22:46.117 info  [caliper] [bind] 	User-provided arguments for npm: "-g"
2022.03.13-10:22:46.117 info  [caliper] [bind] 	Binding for [email protected]. This might take some time...
2022.03.13-10:22:46.117 info  [caliper] [bind] 	Using working directory: /hyperledger/caliper/workspace
2022.03.13-10:22:46.118 info  [caliper] [bind] 	Calling npm with: install -g [email protected]

> [email protected] install /home/node/.npm-global/lib/node_modules/fabric-network/node_modules/pkcs11js
> node-gyp rebuild

make: Entering directory '/home/node/.npm-global/lib/node_modules/fabric-network/node_modules/pkcs11js/build'
  CXX(target) Release/obj.target/pkcs11/src/main.o
In file included from ../../nan/nan.h:58,
                 from ../src/main.cpp:1:
/home/node/.cache/node-gyp/14.19.0/include/node/node.h:793:7: warning: cast between incompatible function types from 'void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)' {aka 'void (*)(v8::Local<v8::Object>)'} to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
  793 |       (node::addon_register_func) (regfunc),                          \
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/node/.cache/node-gyp/14.19.0/include/node/node.h:827:3: note: in expansion of macro 'NODE_MODULE_X'
  827 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/main.cpp:27:1: note: in expansion of macro 'NODE_MODULE'
   27 | NODE_MODULE(pkcs11, init)
      | ^~~~~~~~~~~
  CXX(target) Release/obj.target/pkcs11/src/dl.o
  CXX(target) Release/obj.target/pkcs11/src/const.o
  CXX(target) Release/obj.target/pkcs11/src/pkcs11/error.o
  CXX(target) Release/obj.target/pkcs11/src/pkcs11/v8_convert.o
  CXX(target) Release/obj.target/pkcs11/src/pkcs11/template.o
  CXX(target) Release/obj.target/pkcs11/src/pkcs11/mech.o
  CXX(target) Release/obj.target/pkcs11/src/pkcs11/param.o
  CXX(target) Release/obj.target/pkcs11/src/pkcs11/param_aes.o
  CXX(target) Release/obj.target/pkcs11/src/pkcs11/param_rsa.o
  CXX(target) Release/obj.target/pkcs11/src/pkcs11/param_ecdh.o
  CXX(target) Release/obj.target/pkcs11/src/pkcs11/pkcs11.o
  CXX(target) Release/obj.target/pkcs11/src/async.o
  CXX(target) Release/obj.target/pkcs11/src/node.o
  SOLINK_MODULE(target) Release/obj.target/pkcs11.node
  COPY Release/pkcs11.node
make: Leaving directory '/home/node/.npm-global/lib/node_modules/fabric-network/node_modules/pkcs11js/build'

> [email protected] postinstall /home/node/.npm-global/lib/node_modules/fabric-network/node_modules/protobufjs
> node scripts/postinstall

+ [email protected]
added 82 packages from 117 contributors in 60.685s
2022.03.13-10:23:47.766 info  [caliper] [cli-launch-manager] 	Set workspace path: /hyperledger/caliper/workspace
2022.03.13-10:23:47.766 info  [caliper] [cli-launch-manager] 	Set benchmark configuration path: /tmp/myAssetBenchmark.yaml
2022.03.13-10:23:47.766 info  [caliper] [cli-launch-manager] 	Set network configuration path: /tmp/networkConfig.yaml
2022.03.13-10:23:47.767 info  [caliper] [cli-launch-manager] 	Set SUT type: fabric
2022.03.13-10:23:47.775 info  [caliper] [benchmark-validator] 	No observer specified, will default to `none`
2022.03.13-10:23:47.776 info  [caliper] [caliper-engine] 	Starting benchmark flow
2022.03.13-10:23:47.776 info  [caliper] [caliper-engine] 	Network configuration attribute "caliper.command.start" is not present, skipping start command
2022.03.13-10:23:49.118 info  [caliper] [FabricConnectorFactory] 	Initializing gateway connector compatible with installed SDK: 2.2.11
2022.03.13-10:23:49.146 info  [caliper] [IdentityManager] 	Adding User1 (admin=false) as User1 for organization Org1MSP
2022.03.13-10:23:49.150 info  [caliper] [connectors/v2/FabricGateway] 	Fabric SDK version: 2.2.11; TLS based on Org1MSP: server
2022.03.13-10:23:49.150 info  [caliper] [caliper-engine] 	Executed "init" step in 0.001 seconds
2022.03.13-10:23:49.151 warn  [caliper] [connectors/v2/FabricGateway] 	Install smart contract not available with Fabric SDK version: 2.2.11
2022.03.13-10:23:49.151 info  [caliper] [caliper-engine] 	Executed "install" step in 0 seconds
2022.03.13-10:23:49.155 info  [caliper] [monitor.js] 	No resource monitors specified
2022.03.13-10:23:49.157 info  [caliper] [default-observer] 	Observer interval set to 5000 milliseconds
2022.03.13-10:23:49.162 info  [caliper] [round-orchestrator] 	Preparing worker connections
2022.03.13-10:23:49.162 info  [caliper] [worker-orchestrator] 	Launching worker 1 of 2
2022.03.13-10:23:49.173 info  [caliper] [worker-orchestrator] 	Launching worker 2 of 2
2022.03.13-10:23:49.180 info  [caliper] [worker-orchestrator] 	Messenger not configured, entering configure phase...
2022.03.13-10:23:49.181 info  [caliper] [worker-orchestrator] 	No existing workers detected, entering worker launch phase...
2022.03.13-10:23:49.183 info  [caliper] [worker-orchestrator] 	Waiting for 2 workers to be connected...
2022.03.13-10:23:49.945 info  [caliper] [cli-launch-worker] 	Worker is a locally forked process, skipping binding step already performed by the manager process
2022.03.13-10:23:49.948 info  [caliper] [cli-launch-worker] 	Set workspace path: /hyperledger/caliper/workspace
2022.03.13-10:23:49.948 info  [caliper] [cli-launch-worker] 	Set benchmark configuration path: /tmp/myAssetBenchmark.yaml
2022.03.13-10:23:49.948 info  [caliper] [cli-launch-worker] 	Set network configuration path: /tmp/networkConfig.yaml
2022.03.13-10:23:49.948 info  [caliper] [cli-launch-worker] 	Set SUT type: fabric
2022.03.13-10:23:49.964 info  [caliper] [cli-launch-worker] 	Worker is a locally forked process, skipping binding step already performed by the manager process
2022.03.13-10:23:49.967 info  [caliper] [cli-launch-worker] 	Set workspace path: /hyperledger/caliper/workspace
2022.03.13-10:23:49.967 info  [caliper] [cli-launch-worker] 	Set benchmark configuration path: /tmp/myAssetBenchmark.yaml
2022.03.13-10:23:49.968 info  [caliper] [cli-launch-worker] 	Set network configuration path: /tmp/networkConfig.yaml
2022.03.13-10:23:49.969 info  [caliper] [cli-launch-worker] 	Set SUT type: fabric

then pod restart with unknown reason.

      - name: main
        image: hyperledger/caliper:0.5.0-unstable-20220311182403
        env:
          - name: CALIPER_BENCHCONFIG
            value: /tmp/myAssetBenchmark.yaml
          - name: CALIPER_NETWORKCONFIG
            value: /tmp/networkConfig.yaml 
        command:
          #- ls
          #- /tmp
          - caliper
          - launch
          - manager
          - --caliper-bind-sut 
          - fabric:2.2

SamYuan1990 avatar Mar 13 '22 10:03 SamYuan1990

@SamYuan1990 for caliper 0.5.0 the need to specify --caliper-fabric-gateway-enabled has been removed when using fabric SUT 2.2 as it's unnecessary (I presume that there was a plan to try to write a connector that used the fabric-common package for 2.2 but it was never done). It is still available in the 1.4 SUT because if you don't specify it, it will use the fabric-client apis and if you do specify it, it will use the fabric-network apis.

If you want to try, then you can use the latest docker and npm builds of 0.5.0 (although listed as unstable, I would say they are a better version to use than 0.4.2)

@davidkel as you can see from logs above, I had attempted with serval times, please kindly advise. Or, please let me know once there is new release version been announced.

SamYuan1990 avatar Mar 13 '22 10:03 SamYuan1990

https://github.com/hyperledger-labs/PerformanceSandBox/pull/30 code parts if you interested. @davidkel

SamYuan1990 avatar Mar 13 '22 10:03 SamYuan1990

@SamYuan1990 So your last attempt had some of the correct setup, ie you have to bind an sut in order to use the docker image, however I've never tested the docker image in a K8s environment so don't know if it will work especially when using forked processes. I don't know why it would fail though at that specific point. Interestingly someone else posted a similar issue with using the 0.4.2 docker container here https://github.com/hyperledger/caliper/issues/1248 but I wasn't able to recreate when running a docker image locally. 0.5.0 probably won't be tested in a K8s environment before it's released so any insight you can give into what the issue may be that you are experiencing would be great.

davidkel avatar Mar 13 '22 11:03 davidkel

@SamYuan1990 The author of #1248 said that he didn't have enough memory to run caliper which is why it failed. So I would suggest that you check you have enough resources to run caliper and 2 workers in the same container in K8s.

davidkel avatar Mar 14 '22 13:03 davidkel

@SamYuan1990 The author of #1248 said that he didn't have enough memory to run caliper which is why it failed. So I would suggest that you check you have enough resources to run caliper and 2 workers in the same container in K8s.

I suppose I use default setting for k8s, so memory is no limited? btw, how many memory will it cost?

apiVersion: apps/v1
kind: Deployment
metadata:
  name: caliper
  annotations:
    "sidecar.jaegertracing.io/inject": "true" 
spec:
  replicas: 1
  selector:
    matchLabels:
      app: caliper
  template:
    metadata:
      labels:
        app: caliper
    spec:
      containers:
      - name: main
        image: hyperledger/caliper:0.5.0-unstable-20220311182403
        env:
          - name: CALIPER_BIND_SUT
            value: fabric:2.2
          - name: CALIPER_BENCHCONFIG
            value: /tmp/myAssetBenchmark.yaml
          - name: CALIPER_NETWORKCONFIG
            value: /tmp/networkConfig.yaml 
        command:
          #- ls
          #- /tmp
          - caliper
          - launch
          - manager
        imagePullPolicy: IfNotPresent
        volumeMounts:
          - name: configmap-volume
            mountPath: /tmp
      volumes:
        - name: configmap-volume
          configMap:
              name: fabric-caliper-sample-config
  #restartPolicy: Always

SamYuan1990 avatar Mar 14 '22 13:03 SamYuan1990

@davidkel , I am not in hurry, I am able waiting for a stable version to have a try once.

SamYuan1990 avatar Mar 14 '22 14:03 SamYuan1990

@SamYuan1990 0.5.0 unstable is actually a pretty stable release, just not labelled as such. It would be really good to understand what the problem is in case there is something that could be fixed for a K8s environment otherwise the official release won't get any further changes around this area. The other thing to try would be to use mqtt and launch the workers as separate containers. See https://hyperledger.github.io/caliper/vNext/architecture/#multi-platform-support for more details

davidkel avatar Mar 14 '22 16:03 davidkel