shaka-player icon indicating copy to clipboard operation
shaka-player copied to clipboard

Memory leak on multi-period streams

Open bbert opened this issue 1 year ago • 17 comments

Have you read the FAQ and checked for duplicate open issues? Yes

If the problem is related to FairPlay, have you read the tutorial?

Yes

What version of Shaka Player are you using?

4.2.x => 4.7.x

Can you reproduce the issue with our latest release version? Yes

Can you reproduce the issue with the latest code from main? Yes

Are you using the demo app or your own custom app? Demo app

If custom app, can you reproduce the issue using our demo app? Yes

What browser and OS are you using? chrome, windows

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

https://d24rwxnt7vw9qb.cloudfront.net/v1/dash/e6d234965645b411ad572802b6c9d5a10799c9c1/All_Reference_Streams/4577dca5f8a44756875ab5cc913cd1f1/index.mpd

What configuration are you using? What is the output of player.getConfiguration()?

Default

What did you do?

Play stream and take memory heap snapshots using chrome dev tools at different times

What did you expect to happen? Memory heap to be stable

What actually happened?

Memory heap grows consistently for multi-period streams. On mono-period streams, we dot not notice the same result.

Please find screenshots:

  • Heap snapshots to illustrate inscrease of memory consumption: image

  • Snapshots comparison after 45 minutes image

  • Details and allocation call stack (based on v4.5.x) of retained objects image

Please note that all objects (Text, Element, NodeList ...) are allocated in the same place.

bbert avatar Feb 09 '24 10:02 bbert

Duplicate of https://github.com/shaka-project/shaka-player/issues/6070

avelad avatar Feb 19 '24 07:02 avelad

I'm not sure this is a duplicate of #6070 since #6070 memory issue is related to SegmentTimeline and the one described in this issue is more generally related to multi-periods, and noticeably since at least v 4.2.x.

bbert avatar Feb 19 '24 07:02 bbert

Reopening.

joeyparrish avatar Feb 21 '24 17:02 joeyparrish

@bbert Can you test if it still happens with 4.8.3? Thanks!

avelad avatar May 06 '24 15:05 avelad

@avelad Have you tested on your side? I still observe memory increase: image

bbert avatar May 13 '24 12:05 bbert

We solved a memory leak, but I didn't know if it had solved all your problems or not.

avelad avatar May 13 '24 12:05 avelad

My asumption is that memory consumption should not constantly increase in any case. After a quick check, the issue still remains for SegmentTimeline based multi-period streams.

bbert avatar May 13 '24 12:05 bbert

Do you want send a PR to fix it?

avelad avatar May 13 '24 12:05 avelad

For the time being, I'm not enough aware of source code to try to fix it in the shot term.

It seems indeed that the initial reason of the identified memory leak has been fixed (as discussed in #6070), but here is a potential clue to identify the leak:

image

bbert avatar May 13 '24 13:05 bbert

I have tested the stream in this issue with Cobalt browser with a simple html page and default shaka config. Using main branch (12 May, last commit 5f8628a4a). I can confirm growing memory usage. Also tested in Chromium (124.0.6367.155, Xubuntu 22.04) and see these JS heap size: 5 min : 12-16 MB 1 hour : 83-91 MB 2 hours : 174-179 MB 3 hours : 257-263 MB

PS. We have a similar problem with another dash live stream and I have a fix for it. However that fix doesn't solve this issue.

MichaelSweden avatar May 14 '24 12:05 MichaelSweden

In version 4.10.6 we have introduced some improvements, can you validate if it is enough or do we need more improvements? Thanks!

avelad avatar Jul 15 '24 15:07 avelad

Closing due to inactivity. If this is still an issue for you or if you have further questions, the OP can ask shaka-bot to reopen it by including @shaka-bot reopen in a comment.

shaka-bot avatar Jul 23 '24 07:07 shaka-bot

Hi @avelad From my point of view and the quick test I've done, there is no real improvement.

image

bbert avatar Jul 23 '24 09:07 bbert

we should reopen this.

dbanbahji avatar Aug 01 '24 20:08 dbanbahji

Any updates on this? Would implementing a custom ABR solution help as an intermediate step?

shreyaskaundinya avatar Aug 06 '24 15:08 shreyaskaundinya