Hyperledger fabric Error: 14 UNAVAILABLE: TCP Write failed

1.8k Views Asked by At

When chaincode container remains idle for some time then it stops with error:

ERROR [lib/handler.js] Chat stream with peer - on error: "Error: 14 UNAVAILABLE: EOF\n    at createStatusError (/usr/local/src/node_modules/grpc/src/client.js:64:15)\n    at ClientDuplexStream._emitStatusIfDone (/usr/local/src/node_modules/grpc/src/client.js:270:19)\n at ClientDuplexStream._receiveStatus (/usr/local/src/node_modules/grpc/src/client.js:248:8)\n    at /usr/local/src/node_modules/grpc/src/client.js:804:12"

And when the first request comes after idle time it gives an error of

Error: 14 UNAVAILABLE: TCP Write failed

After that for second request error changes to following:

Error: SERVICE_UNAVAILABLE
at ClientDuplexStream.broadcast.on (/app/node_modules/fabric-client/lib/Orderer.js:172:22)
at emitOne (events.js:116:13)
at ClientDuplexStream.emit (events.js:211:7)
at ClientDuplexStream._emitStatusIfDone (/app/node_modules/grpc/src/client.js:236:12)
at ClientDuplexStream._receiveStatus (/app/node_modules/grpc/src/client.js:213:8)
at Object.onReceiveStatus (/app/node_modules/grpc/src/client_interceptors.js:1290:15)
at InterceptingListener._callNext (/app/node_modules/grpc/src/client_interceptors.js:564:42)
at InterceptingListener.onReceiveStatus (/app/node_modules/grpc/src/client_interceptors.js:614:8)
at /app/node_modules/grpc/src/client_interceptors.js:1110:18

From third request onwards all works fine.

I was using fabric-shim 1.2.0 but after upgrading it to 1.3.0 the error appears randomly.

I am using fabric 1.3.0.

Edit: After upgrading fabric shim to 1.3.1, the error is changed to following:

error: [Orderer.js]: sendBroadcast - on error: "Error: 14 UNAVAILABLE: TCP Write failed\n    at Object.exports.createStatusError (/app/node_modules/grpc/src/common.js:87:15)\n    at ClientDuplexStream._emitStatusIfDone (/app/node_modules/grpc/src/client.js:235:26)\n    at ClientDuplexStream._receiveStatus (/app/node_modules/grpc/src/client.js:213:8)\n    at Object.onReceiveStatus (/app/node_modules/grpc/src/client_interceptors.js:1290:15)\n    at InterceptingListener._callNext (/app/node_modules/grpc/src/client_interceptors.js:564:42)\n    at InterceptingListener.onReceiveStatus (/app/node_modules/grpc/src/client_interceptors.js:614:8)\n    at /app/node_modules/grpc/src/client_interceptors.js:1110:18"
Error: SERVICE_UNAVAILABLE
    at ClientDuplexStream.broadcast.on (/app/node_modules/fabric-client/lib/Orderer.js:172:22)
    at emitOne (events.js:116:13)
    at ClientDuplexStream.emit (events.js:211:7)
    at ClientDuplexStream._emitStatusIfDone (/app/node_modules/grpc/src/client.js:236:12)
    at ClientDuplexStream._receiveStatus (/app/node_modules/grpc/src/client.js:213:8)
    at Object.onReceiveStatus (/app/node_modules/grpc/src/client_interceptors.js:1290:15)
    at InterceptingListener._callNext (/app/node_modules/grpc/src/client_interceptors.js:564:42)
    at InterceptingListener.onReceiveStatus (/app/node_modules/grpc/src/client_interceptors.js:614:8)
    at /app/node_modules/grpc/src/client_interceptors.js:1110:18
2

There are 2 best solutions below

0
On

First add your user to the docker group

sudo usermod -aG docker $USER

And then change the access permissions

sudo chmod 777 /var/run/docker.sock
4
On

This issue seems related to grpc version change , can you try with stable grpc version