Skip to content

Possible memory leak on nack package #328

Open
@tubzby

Description

@tubzby

I have an SFU program using ion-sfu (modified a bit since the original repo is outdated), which depends on interceptor v0.1.37.

Recently, we noticed that the memory usage of this process has been increasing over the past few days, the graph looks like:

Image

So I use go tool pprof to get the heap output and then found out that most of the active memory was allocated by the nack package:

Image

Image

top of pprof:

(pprof) top
Showing nodes accounting for 4.89GB, 88.17% of 5.55GB total
Dropped 522 nodes (cum <= 0.03GB)
Showing top 10 nodes out of 106
      flat  flat%   sum%        cum   cum%
    3.55GB 63.91% 63.91%     3.55GB 63.91%  github.com/pion/interceptor/pkg/nack.newPacketManager.func2
    0.41GB  7.38% 71.30%     0.41GB  7.38%  github.com/pion/webrtc/v4/pkg/media/samplebuilder.New
    0.28GB  5.04% 76.34%     0.28GB  5.04%  gdcx.com/sfu/cluster.NewSFU.NewBufferFactory.func1
    0.24GB  4.25% 80.59%     3.97GB 71.49%  github.com/pion/interceptor/pkg/nack.(*packetManager).NewPacket
    0.18GB  3.33% 83.91%     0.18GB  3.33%  github.com/pion/interceptor/pkg/nack.newPacketManager.func1
    0.09GB  1.54% 85.45%     0.09GB  1.54%  github.com/pion/transport/v3/packetio.(*Buffer).grow
    0.05GB  0.87% 86.32%     0.05GB  0.87%  syscall.NetlinkRIB
    0.04GB  0.69% 87.00%     0.04GB  0.69%  log.New
    0.03GB  0.61% 87.61%     0.03GB  0.61%  github.com/pion/sdp/v3.(*unmarshalCache).cloneMediaAttributes
    0.03GB  0.56% 88.17%     0.05GB  0.81%  github.com/pion/webrtc/v4/pkg/media/samplebuilder.(*SampleBuilder).buildSample
(pprof)

Is this a memory leak? How could I debug/solve it?

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