Using fabric composer v0.7.0 I have deployed a business network to a Blockchain service on Bluemix (v0.6).
After the app runs for a while I get the following error:
throw er; // Unhandled 'error' event
^
Error
at ClientDuplexStream._emitStatusIfDone (/home/vcap/app/node_modules/grpc/src/node/src/client.js:189:19)
at ClientDuplexStream._receiveStatus (/home/vcap/app/node_modules/grpc/src/node/src/client.js:169:8)
This sometimes happens when executing the composer network deploy
command as well.
This problem occurs because of the way the event hub works in Hyperledger Fabric v0.6. The Node.js client for Fabric
hfc
maintains a persistent connection to the event hub but does not cope well with network blips/disconnects etc (it just kills the client). Persistent connections aren't really cloud friendly as the network/routing will just terminate idle connections after a while. https://stackoverflow.com/users/7512977/simon-stone
BusinessNetworkConnection.connect()
before every chaincode invoke to recreate the event hub connection. Please note that this is not very efficient, as making the connection takes a whileIf the error occurs when deploying with the composer-cli
you may want to try executing the command again after a minute or so.
Calling BusinessNetworkConnection.ping()
during a set interval will not help with the issue because the problem is caused by the event hub, and events are only published on actual transactions. ping()
is a read-only chaincode query that does not create a transaction.