hyperledger-fabrichyperledger-fabric-sdk-go

Connection timeout when installing chaincode using fabric-sdk-go


I have a problem that there is always a grpcs timeout when installing the chaincode using fabric-sdk-go. The GRCPS request is made from the local machine to its docker containers.

ErrorMsg:

lscc.getinstalledchaincodes failed: SendProposal failed: Transaction processing for endorser [localhost:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection timed out [localhost:7051]

ENV:

Mac OSX

docker version: 18.03.1-ce

docker-compose version 1.21.1, build 5a3f1a3

fabric-sdk-go: master

The local fabric network is set up by the official fabric-ca example.

docker-compose.yaml: Gist

local network-config.yaml: Gist

client go app: Gist

Is there anything wrong with my network-config.yaml???

What I've tried:

  1. Tried to disable CORE_PEER_TLS_CLIENTAUTHREQUIRED in docker-compose.yaml, failed..

  2. Edited /etc/hosts file with the line 127.0.0.1 peer1-xiaoyudian..., failed..

  3. Increased the peer.timeout.connections and others timeout options in network-config.yaml, failed..

  4. Increased the grpcOptions.keep-alive-time in network-config.yaml, failed..

  5. Changed the host of peers.xxxx.url from localhost to the domain in network-config.yaml, failed...

  6. Added the entityMathcers in network-config.yaml, failed...

  7. Failed....

Answer: Someone from the rocket.chat told me:

  1. run: export GRPC_GO_LOG_SEVERITY_LEVEL=error
  2. run: export GRPC_GO_LOG_VERBOSITY_LEVEL=2
  3. in the client code add this line: grpclog.SetLogger(logger)

And the log says it a certificate issue for handshaking with peers.


Solution

  • Refer https://github.com/hyperledger/fabric-sdk-go/tree/master/test/fixtures/config/overrides for how URLs are overridden to use localhost. In your case, you have to use local_entity_matchers.yaml & local_orderers_peers_ca.yaml combined in samples provided.

    One more thing I noticed in your network-config.yaml, mapped host name is same as actual peer name. Entity matcher doesn't kick in here. Refer the entity matchers used in the sample given above.