grpc / grpc/grpc-node

Update guidance on underlying TCP connections

Open
#1,756 7 comments 0 reactions 0 assignees View on GitHub
package: @grpc/grpc-js package: grpc
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

### Is your feature request related to a problem? Please describe.
We have a python based grpc server and a node js server which acts as the grpc client. Currently on each node js request, we create a new grpc.Client object providing to it the user credentials from the node js request.

```
const credentials = grpc.credentials.combineChannelCredentials(SSL_CREDENTIALS, userCredentials);

const grpcClient = new protoPackage[proto][service](
API_URL,
credentials,
GRPC_OPTIONS
);
```

We had a bug where we were not closing the client objects after the rpc call, leading to an explosion in tcp connections and eventually our grpc server would crash due to file handle exhaustion. This was evidenced by `lsof` output. After closing the clients on node js, the tcp connection leak disappeared.

### Describe the solution you'd like
Does the node.js client reuse TCP connections underneath? It was clearly not doing so when we didn't close() the client.

If it does, can you please update the API documentation to say that closing() is an absolutely must.
If it does not, please provide an API to reuse TCP connections.

### Describe alternatives you've considered
None

### Additional context
None

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.