Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

channelz support might have introduced memory leak #1958

Closed
sasaxing opened this issue Nov 3, 2021 · 2 comments
Closed

channelz support might have introduced memory leak #1958

sasaxing opened this issue Nov 3, 2021 · 2 comments

Comments

@sasaxing
Copy link

sasaxing commented Nov 3, 2021

Problem description

Upgrading @grpc-js from 1.3.8 to 1.4.1 introduces memory leak.

The image shows the heap space size used (old space)

  • green line is using @grpc-js@1.3.8;
  • yellow one is @grpc-js@1.4.1.

image

Reproduction steps

Environment

  • OS name, version and architecture: [docker container x86_64 GNU/Linux Ubuntu 20.04.3 LTS]
  • Node version [v16.12.0]
  • Package name and version: @grpc-js@1.4.1, consumed by @nestjs/microservice@8.0.11 (same case for 8.1.2)

Additional context

This is the screenshot of the snapshot diff with 15 hours gap in between.
As the object stack indicates, the timestamp pushed into events array each time addTrace is called, it keeps adding new trace but is never garbage collected somehow.

According to the grpc version diff, the problem might be introduced by this commit: grpc-js: Add channelz support, when introducing the new object ChannelzTrace in server.ts after release of 1.4.0.

snapshot-diff

Is it something now should be disabled explicitly if not needed?

@murgatroid99
Copy link
Member

Thank you for the report. This was also reported in #1941, and as a result, I published grpc-js version 1.4.2 with hard limits on the number of retained channelz trace events per channel/subchannel/server, and support for the channel/server option grpc.enable_channelz, which can be set to 0 to disable channelz entirely. Please try it out to see if it solves your problem.

@sasaxing
Copy link
Author

sasaxing commented Nov 9, 2021

looks better. Thanks for the fast fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants