IBM BLUEMIX BLOCKCHAIN SDK-DEMO failing

后端 未结 1 924
走了就别回头了
走了就别回头了 2021-01-25 03:42

I have been working with HFC SDK for Node.js and it used to work, but since last night I am having some problems.

When running helloblockchain.js only few times works, mo

相关标签:
1条回答
  • 2021-01-25 03:54

    These types of intermittent issues are usually related to GRPC. An initial suggestion is to ensure that you are using at least GRPC version 1.0.0.

    If you are using a Mac, then the maximum number of open file descriptors should be checked (using ulimit -n). Sometimes this is initially set to a low value such as 256, so increasing the value could help.

    There are a couple of GRPC issues with similar symptoms.

    • https://github.com/grpc/grpc/issues/8732
    • https://github.com/grpc/grpc/issues/8839
    • https://github.com/grpc/grpc/issues/8382

    There is a grpc.initial_reconnect_backoff_ms property that is mentioned in some of these issues. Increasing the value past the 1000 ms level might help reduce the frequency of issues. Below are instructions for how the helloblockchain.js file can be modified to set this property to a higher value.

    1. Open the helloblockchain.js file in the Hyperledger Fabric Client example and find the enrollAndRegisterUsers function.
    2. Add “grpc.initial_reconnect_backoff_ms": 5000 to the setMemberServicesUrl call.

      chain.setMemberServicesUrl(ca_url, {
              pem: cert, "grpc.initial_reconnect_backoff_ms": 5000
      });
      
    3. Add “grpc.initial_reconnect_backoff_ms": 5000 to the addPeer call.

      chain.addPeer("grpcs://" + peers[i].discovery_host + ":" + peers[i].discovery_port, 
      {pem: cert, "grpc.initial_reconnect_backoff_ms": 5000
      });       
      

    Note that setting the grpc.initial_reconnect_backoff_ms property may reduce the frequency of issues, but it will not necessarily eliminate all issues.

    The connection to the eventhub that is made in the helloblockchain.js file can also be a factor. There is an earlier version of the Hyperledger Fabric Client that does not utilize the eventhub. This earlier version could be tried to determine if this makes a difference. After running git clone https://github.com/IBM-Blockchain/SDK-Demo.git, run git checkout b7d5195 to use this prior level. Before running node helloblockchain.js from a Node.js command window, the git status command can be used to check the code level that is being used.

    0 讨论(0)
提交回复
热议问题