NodeJs - ratelimited gRPC shutdowns the client silently

I’ve been using the testnet endpoint node.testnet.concordium.com:20000 to retrieve blocks from the chain using the NodeJS client. when I send in a huge number of parallel requests, I believe the gRPC server ratelimits and in the process, client exits silently without throwing any error. is this normally behaviour? will I be able to catch ratelimit errors so that I can handle it on the client side?

Hi Naveen,

The client should throw an error if something goes wrong, rate limit or otherwise. Can you provide an minimal example of how you are doing this?

@shjort it looks like this happens when I create too many gRPC client instances with the same transport/options. Apparently they all share the same connection. I wonder if the process gets shutdown by the OS or if the client itself calls exit on the process.

I also noticed that the process does not exit when I create the clients in seperate threads, probably because they are using seperate connections from each thread?

I’m not sure how the gRPC client is implemented, but you can check it at https://github.com/grpc/grpc-node/tree/master/packages/grpc-js, to see if it shares connections between clients in the same thread.
Are you catching errors, checking for unhandled rejections in your child processes and checking the codes that your processes are exiting with?

I don’t understand why it would not throw errors, so I can’t really help you.

Though I would suggest just using a single client to avoid these problems, if possible.