kuberneteshyperledger-fabrichyperledgeristiohyperledger-chaincode

Hyperledger fabric chaincode connection with peer getting dropped


I have a hyperledger fabric network version 2.4.4 running on Kubernetes. The peers and other components are running behind istio ingress. The chaincode is running on dind (docker-in-docker) container and connects to peer through its URL. The problem is the chaincode connection is being dropped after few minutes. Below are the logs:

2022-07-14T04:31:13.057Z info [c-api:lib/handler.js]                              [assetschannel-ddc183b4] Calling chaincode Invoke() succeeded. Sending COMPLETED message back to peer  
2022-07-14T04:33:04.197Z error [c-api:lib/handler.js]                             Chat stream with peer - on error: %j "Error: 14 UNAVAILABLE: Connection dropped\n    at Object.callErrorFromStatus (/usr/local/src/node_modules/@grpc/grpc-js/build/src/call.js:31:26)\n    at Object.onReceiveStatus (/usr/local/src/node_modules/@grpc/grpc-js/build/src/client.js:391:49)\n    at Object.onReceiveStatus (/usr/local/src/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)\n    at /usr/local/src/node_modules/@grpc/grpc-js/build/src/call-stream.js:187:78\n    at processTicksAndRejections (node:internal/process/task_queues:78:11)"

I did set the following environment variables in the peer pod to keep the connection alive:

CORE_CHAINCODE_KEEPALIVE: 60000
CORE_PEER_KEEPALIVE_CLIENT_INTERVAL: 600s
CORE_PEER_KEEPALIVE_CLIENT_TIMEOUT: 2s
CORE_PEER_KEEPALIVE_DELIVERYCLIENT_INTERVAL: 20s
CORE_PEER_KEEPALIVE_MININTERVAL: 15s

but this did not resolve the issue.

Any suggestions would be appreciated.


Solution

  • It appears to be an issue with aws elb. The idle timeout was set to 60s which was breaking the connection between chaincode and peer when there was no communication between them. Increasing this time fixed the issue.