google-cloud-node
google-cloud-node copied to clipboard
Dialogflow: Memory leak when a client is created and immediately closed
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 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
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?).
Other objects like ConversationClient and more have the same issue.