Skip to content

channelz support might have introduced memory leak #1958

Closed

Description

@sasaxing

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?

Activity

  1. murgatroid99 commented on Nov 3, 2021

    @murgatroid99
    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.

  2. sasaxing commented on Nov 9, 2021

    @sasaxing
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions