googleapis / googleapis/google-cloud-node

Dialogflow: Memory leak when a client is created and immediately closed

Open
#4,372 1 comment 0 reactions 0 assignees View on GitHub
api: dialogflow priority: p2 type: bug
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

Thanks for stopping by to let us know something could be better!

**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

- Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
- Search StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js
- Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting
- Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq

If you are still having issues, please be sure to include as much information as possible:

#### Environment details

- which product (packages/*): @google-cloud/dialogflow
- OS: All
- Node.js version: 18.16.0
- npm version: 9.5.0
- google-cloud-node version: 5.7.1

#### Steps to reproduce

```javascript
import Dialogflow from '@google-cloud/dialogflow';

const opts = {
servicePath: "dialogflow.googleapis.com",
port: 443,
clientConfig: {
},
fallback: false,
credentials: {
private_key: "...",
client_email: "...",
},
projectId: "...",
scopes: [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/dialogflow",
],
apiEndpoint: undefined,
};
const conversationProfilesClient = new Dialogflow.ConversationProfilesClient(opts);
await conversationProfilesClient.close();
```

The constructor creates `operationsClient` which tries to connect and registers itself in channelz, but the ctor doesn't assign anything to `conversationProfilesStub`, so `close` is no-op. We're left with a memory leak in channelz.

Our use-case was creating this object for calling `projectLocationConversationProfilePath` (why are these functions not static?).

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.