I am running 3 docker containers, let's say:
- container-1 (node.js application)
- container-2 (Golang application)
- container-3 (Golang application)
All these containers communicate using gRPC.
I am doing a unary RPC (Request/Reply) call in container-1 which calls a method of container-2. This method performs various operations and calls numerous unary RPCs (~20) of container-3.
During the whole process sometimes I get the following error (note: not every time, even my input data is same):
rpc error: code = Canceled desc = context canceled
And whenever the error comes, it occurs at one of the last 4-5 RPCs calls (in container-2).
One thing I observed that this error comes after ~1 min from when I started the process.
So,
- There might be some default context time after the context gets canceled. If it is, how can I increase that time?
- Can anyone please explain to me if there is something I am missing in the context or gRPC in Golang.
Thank you.
Edit:
Following is the gist code that shows how I am connecting and calling the RPC:
// load proto
const proto = await grpc.load(PROTO_PATH);
// connect to service
const SERVICE = new proto.types.MyService(SERVICE_ADDR, grpc.credentials.createInsecure(), {
"grpc.keepalive_time_ms" : (5 * 60 * 1000),
"grpc.keepalive_permit_without_calls": 1,
})
// calling RPC
SERVICE.sync({
id: Id,
}, (err, resp) => {
if (err) {
return reject(err);
}
if (!resp.success) {
return reject(new Error(`Action error: ${resp.intended_action}: ${resp.reason}`));
}
resolve(resp.intended_action);
});