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

Support for Chaincode execution timeout (CHAINCODE_EXECUTETIMEOUT) #1245

Closed
m0bi5 opened this issue Feb 26, 2022 · 1 comment · Fixed by #1246
Closed

Support for Chaincode execution timeout (CHAINCODE_EXECUTETIMEOUT) #1245

m0bi5 opened this issue Feb 26, 2022 · 1 comment · Fixed by #1246
Assignees
Labels
bug Something isn't working component/fabric Related to the HL Fabric adapter
Milestone

Comments

@m0bi5
Copy link

m0bi5 commented Feb 26, 2022

Which Caliper version are you using?

v0.4.2

Which Node.JS version are you using?

v10.19.0

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?

I have modified the basic chaincode available in fabric-samples and added custom contract functions. These functions take a long time to run (~4-10 seconds). I am trying to benchmark these functions using caliper. The benchmarks run successfully when I set the txNumber: 1 (in my benchmarkConfig file) however when I set the txNumber: 5 I get the following error :

caliper    | 2022-02-26T19:48:35.156Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - peer0.org2.example.com:11051 timed out after: 30000
caliper    | 2022-02-26T19:48:35.156Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - peer0.org1.example.com:7051 timed out after: 30000
.
.

Everything works well on the peer side as I have set the CHAINCODE_EXECUTETIMEOUT=200s. However, I am not sure how to increase the timeout for the caliper workers. I am passing the --caliper-fabric-timeout-invokeorquery 600 flag to launch manager command but that does not seem to do the trick.

P.S - I have looked at #755 but the link to which @aklenik points to seems broken and I cannot figure out where invokeSmartContract is called. I tried searching for this function in the source code/documentation but couldn't find it as well, not sure if this function was removed in the newer versions of caliper.

What was the observed incorrect behavior?

Benchmark should run without the workers timing out

Please provide the error logs and their surroundings.

caliper    | 2022.02.26-19:47:23.094 info  [caliper] [worker-message-handler]   Worker#0 is starting Round#5
caliper    | 2022.02.26-19:47:23.095 info  [caliper] [caliper-worker]   Worker #0 starting workload loop
caliper    | 2022.02.26-19:47:28.095 info  [caliper] [default-observer]         [Assign Round 5 Transaction Info] - Submitted: 5 Succ: 0 Fail:0 Unfinished:5
caliper    | 2022.02.26-19:47:33.096 info  [caliper] [default-observer]         [Assign Round 5 Transaction Info] - Submitted: 5 Succ: 0 Fail:0 Unfinished:5
caliper    | 2022.02.26-19:47:38.097 info  [caliper] [default-observer]         [Assign Round 5 Transaction Info] - Submitted: 5 Succ: 0 Fail:0 Unfinished:5
caliper    | 2022.02.26-19:47:43.098 info  [caliper] [default-observer]         [Assign Round 5 Transaction Info] - Submitted: 5 Succ: 0 Fail:0 Unfinished:5
caliper    | 2022.02.26-19:47:48.099 info  [caliper] [default-observer]         [Assign Round 5 Transaction Info] - Submitted: 5 Succ: 0 Fail:0 Unfinished:5
caliper    | 2022.02.26-19:47:53.100 info  [caliper] [default-observer]         [Assign Round 5 Transaction Info] - Submitted: 5 Succ: 0 Fail:0 Unfinished:5
caliper    | 2022-02-26T19:47:53.109Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - peer0.org2.example.com:11051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.110Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - peer0.org1.example.com:7051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.110Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.110Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.111Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G1:0 - error on endorsement to peer0.org2.example.com:11051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.111Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G0:1 - error on endorsement to peer0.org1.example.com:7051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.111Z - error: [Transaction]: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    | 2022.02.26-19:47:53.112 error [caliper] [connectors/v2/FabricGateway]      Failed to perform submit transaction [CreateAssignAsset] using arguments [425788883384,blue,20,penguin,500],  with error: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    |     at newEndorsementError (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:49:12)
caliper    |     at getResponsePayload (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:17:23)
caliper    |     at Transaction.submit (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:212:28)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022-02-26T19:47:53.298Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - peer0.org2.example.com:11051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.299Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.299Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G1:0 - error on endorsement to peer0.org2.example.com:11051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.300Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - peer0.org1.example.com:7051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.300Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.300Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G0:1 - error on endorsement to peer0.org1.example.com:7051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.301Z - error: [Transaction]: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    | 2022.02.26-19:47:53.301 error [caliper] [connectors/v2/FabricGateway]      Failed to perform submit transaction [CreateAssignAsset] using arguments [81793907602,blue,20,penguin,500],  with error: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    |     at newEndorsementError (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:49:12)
caliper    |     at getResponsePayload (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:17:23)
caliper    |     at Transaction.submit (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:212:28)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022-02-26T19:47:53.501Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - peer0.org2.example.com:11051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.502Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - peer0.org1.example.com:7051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.502Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.502Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.502Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G1:0 - error on endorsement to peer0.org2.example.com:11051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.502Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G0:1 - error on endorsement to peer0.org1.example.com:7051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.502Z - error: [Transaction]: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    | 2022.02.26-19:47:53.502 error [caliper] [connectors/v2/FabricGateway]      Failed to perform submit transaction [CreateAssignAsset] using arguments [1616188639044,blue,20,penguin,500],  with error: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    |     at newEndorsementError (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:49:12)
caliper    |     at getResponsePayload (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:17:23)
caliper    |     at Transaction.submit (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:212:28)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022-02-26T19:47:53.699Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - peer0.org2.example.com:11051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.700Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - peer0.org1.example.com:7051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.700Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.700Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.700Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G1:0 - error on endorsement to peer0.org2.example.com:11051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.700Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G0:1 - error on endorsement to peer0.org1.example.com:7051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.700Z - error: [Transaction]: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    | 2022.02.26-19:47:53.700 error [caliper] [connectors/v2/FabricGateway]      Failed to perform submit transaction [CreateAssignAsset] using arguments [20769495052,blue,20,penguin,500],  with error: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    |     at newEndorsementError (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:49:12)
caliper    |     at getResponsePayload (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:17:23)
caliper    |     at Transaction.submit (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:212:28)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022-02-26T19:47:53.900Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - peer0.org2.example.com:11051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.901Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - peer0.org1.example.com:7051 timed out after: 30000
caliper    | 2022-02-26T19:47:53.901Z - error: [Endorser]: sendProposal[peer0.org2.example.com:11051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.901Z - error: [Endorser]: sendProposal[peer0.org1.example.com:7051] - rejecting with: Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.901Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G1:0 - error on endorsement to peer0.org2.example.com:11051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.901Z - error: [DiscoveryHandler]: _build_endorse_group_member >> G0:1 - error on endorsement to peer0.org1.example.com:7051 error Error: REQUEST TIMEOUT
caliper    | 2022-02-26T19:47:53.901Z - error: [Transaction]: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    | 2022.02.26-19:47:53.901 error [caliper] [connectors/v2/FabricGateway]      Failed to perform submit transaction [CreateAssignAsset] using arguments [685219497620,blue,20,penguin,500],  with error: Error: No valid responses from any peers. Errors:
caliper    |     peer=undefined, status=grpc, message=Endorsement has failed
caliper    |     at newEndorsementError (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:49:12)
caliper    |     at getResponsePayload (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:17:23)
caliper    |     at Transaction.submit (/home/node/.npm-global/lib/node_modules/fabric-network/lib/transaction.js:212:28)
caliper    |     at process._tickCallback (internal/process/next_tick.js:68:7)
caliper    | 2022.02.26-19:47:54.977 info  [caliper] [connectors/v2/FabricGateway]      disconnecting gateway for user User1
caliper    | 2022.02.26-19:47:54.977 info  [caliper] [worker-message-handler]   Worker#0 finished Round#5

Please provide your benchmark configuration file content, if possible.

test:

    name: basic-contract-benchmark

    description: test benchmark

    workers:

      type: local

      number: 1

    rounds:
        - label: Assign

          description: Write asset benchmark

          txNumber: 5

          rateControl: 

            type: fixed-rate

            opts:

              tps: 5

          workload:

            module: workload/createAssignAsset.js

            arguments:

              assets: 10

              contractId: basic

Please provide your network configuration file content, if possible.

name: Calier test

version: "2.0.0"



caliper:

  blockchain: fabric



channels:

  - channelName: mychannel

    contracts:

    - id: basic



organizations:

  - mspid: Org1MSP

    identities:

      certificates:

      - name: 'User1'

        clientPrivateKey:

          path: '/hyperledger/caliper/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv_sk'

        clientSignedCert:

          path: '/hyperledger/caliper/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]'

    connectionProfile:

      path: '/hyperledger/caliper/crypto-config/peerOrganizations/org1.example.com/connection-org1.yaml'

      discover: true

Please provide your workload module content, if possible.

'use strict';

const { WorkloadModuleBase } = require('@hyperledger/caliper-core');
class MyWorkload extends WorkloadModuleBase {
    constructor() {
        super();
    }
    
    async initializeWorkloadModule(workerIndex, totalWorkers, roundIndex, roundArguments, sutAdapter, sutContext) {
        await super.initializeWorkloadModule(workerIndex, totalWorkers, roundIndex, roundArguments, sutAdapter, sutContext);
    }
    
    async submitTransaction() {
        const assetID = parseInt(Date.now() * Math.random());
        //console.log(`Worker ${this.workerIndex}: Creating asset ${assetID}`);
        const request = {
            contractId: this.roundArguments.contractId,
            contractFunction: 'CreateAssignAsset',
            invokerIdentity: 'User1',
            contractArguments: [assetID,'blue','20','penguin','500'],
            readOnly: false
        };
        await this.sutAdapter.sendRequests(request);
    }
    
    async cleanupWorkloadModule() {

    }
}

function createWorkloadModule() {
    return new MyWorkload();
}

module.exports.createWorkloadModule = createWorkloadModule;

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

No response

@davidkel davidkel added bug Something isn't working component/fabric Related to the HL Fabric adapter labels Feb 27, 2022
@davidkel
Copy link
Contributor

davidkel commented Feb 27, 2022

The invokeorquery option only influences the overall submit process (ie from submission to comitted) and doesn't affect the timeout for the endorse part which the node sdk defaults to 30 seconds, and it doesn't look like the node-sdk provides any other way to alter this default value except via code so unfortunately it's not possible at the moment to change that timeout without changing the caliper code.

It's a one line change in this section of code
https://github.com/hyperledger/caliper/blob/62de24084df33c5177edffd52acb2d5da2a1be7b/packages/caliper-fabric/lib/connector-versions/v2/FabricGateway.js#L270

            eventHandlerOptions: {
                commitTimeout: this.configDefaultTimeout,
                strategy: EventStrategies[this.configEventStrategy]
            },

to

            eventHandlerOptions: {
                endorseTimeout: this.configDefaultTimeout,
                commitTimeout: this.configDefaultTimeout,
                strategy: EventStrategies[this.configEventStrategy]
            },

And then invokeorquery will also change the endorse timeout

davidkel pushed a commit to davidkel/caliper that referenced this issue Mar 2, 2022
@davidkel davidkel self-assigned this Mar 2, 2022
davidkel pushed a commit to davidkel/caliper that referenced this issue Mar 2, 2022
@davidkel davidkel added this to the v0.5.0 milestone Mar 2, 2022
davidkel added a commit that referenced this issue Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/fabric Related to the HL Fabric adapter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants