Skip to content

Memory leak in PCMetrics class #859

Open
@CMExile

Description

@CMExile

My team is using parallel-consumer in production, and we observed increasing memory usage over time in all of our services.
After monitoring the heap, we found that this stack trace was responsible for 96% of the heap size after 3 days of uptime:

Image

Image

This is reproducible locally. Whenever the parallel-consumer attempts to commit its offsets, it creates two new timers and adds them to the registeredMetrics list in PCMetrics, even if the exact tag combination already exists.

Keeping track of the registeredMetrics list shows this after 10 minutes (With a 1 second commit interval):
Image

Changing the list to a set seems to fix the issue, but not sure if a more sophisticated method would be preferred.

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