WebRTC: memory leak using DataChannel

RESOLVED INVALID

Status

()

RESOLVED INVALID
3 years ago
3 years ago

People

(Reporter: smayoral, Unassigned)

Tracking

46 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [MemShrink])

Attachments

(5 attachments)

121.98 KB, application/x-gzip
Details
103.50 KB, application/x-gzip
Details
103.65 KB, application/x-gzip
Details
102.53 KB, application/x-gzip
Details
95.06 KB, image/png
Details
(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36

Steps to reproduce:

My windows application opens a DataChannel to Firefox and I transmit PNG images which will be displayed in a canvas object.


Actual results:

Firefox stops receiving data and Windows Task Manages shows a huge memory usage for Firefox, more than 700 MB. Firefox even crashes sometimes.


Expected results:

Firefox should free allocated memory and keep receiving data over the DataChannel.
Version 45.0.2 works correctly.

Updated

3 years ago
Component: Untriaged → WebRTC

Comment 1

3 years ago
Could you type about:memory in the location bar, then save and attach a memory log when the issue appears.

In addition, could you provide a simple testcase to reproduce the issue.
Flags: needinfo?(smayoral)
(Reporter)

Comment 2

3 years ago
Created attachment 8756003 [details]
memory-report.json.gz
(Reporter)

Comment 3

3 years ago
I just open a DataChannel and send many PNG images to it. I have just tested that the problem appears even so:

        var onDataChannelMessage = function (event) {
        }

I do nothing with the received data. I think you should be able to reproduce it. Maybe it depends how fast Firefox is receiving data.

Updated

3 years ago
Whiteboard: [MemShrink]
106MB of heap-unclassified for 11MB of canvas pixel data, I call that a smoking gun.

Sergio, would you be able to give us a way to reproduce the problem so we can investigate?

Jesup, any idea off hand in this range (works in 45, does not work in 46).
Flags: needinfo?(rjesup)
(Reporter)

Comment 5

3 years ago
my windows application is sharing the desktop or just an application, applies PNG/JPEG compression and send the data over DTLS/SCTP to Firefox. 
It is difficult for me to provide you a way to reproduce the problem. 
But as I said, in the onDataChannelMessage associated with the DataChannel I just returned without doing anything with the data and the problem still persists.
The point is that I eventually send a high bitrate to Firefox, nearly 1MB/sec.
How large are the messages?  Are they ArrayBuffers or Blobs?  Is the leak on the receiving side, or the sending side?  If need be, open two browsers on the same machine and make the call between them.  (./firefox -profilemanager -no-remote   will let you run multiple browsers and profiles easily)  Is this all over a single DataChannel? (I assume so).

Can you provoke a leak, then open a tab with about:memory and select Minimize Memory Usage, and see if the leak disappears.  Then close one of the tabs, Minimize again, and check.  Then the other tab, and repeat.  (This will also will help determine which side is the cause)

Thanks
Flags: needinfo?(rjesup)
(Reporter)

Comment 7

3 years ago
- different sizes, from 20 KB to some bytes
- ArrayBuffers
- Firefox only at the receiving side. Sending side is a windows application (.exe)
Can you perform the diagnostic steps in comment 6? That should give us an idea of where the problem lies.

Updated

3 years ago
Whiteboard: [MemShrink] → [MemShrink][needinfo reporter 5/31/16]
(Reporter)

Comment 9

3 years ago
i already attached a memory dump and as i said, there is only Firefox at the receiving side. I will try to do the diagnostic next week.
Sergio: Per comment 6, we would like a dump of about:memory after selecting Minimize Memory Usage.  (See comment 6).  I think it's just data waiting for GC, but if it isn't this will show that.  (Since Firefox is receiving data from a windows exe, you can ignore the "other tab" questions).  Thanks
Whiteboard: [MemShrink][needinfo reporter 5/31/16] → [MemShrink][needinfo reporter 6/1/16]
(Reporter)

Comment 11

3 years ago
Hi, selecting Minimize Memory Usage did not help. I am not able to get a memory dump when Firefox is using over 800 MB, only till 600 MB. I hope you can find the problem. Thanks.
(Reporter)

Comment 12

3 years ago
Created attachment 8759094 [details]
memory-report.json.gz
(Reporter)

Comment 13

3 years ago
Created attachment 8759095 [details]
memory-report.json_min.gz
(Reporter)

Comment 14

3 years ago
Created attachment 8759096 [details]
memory-report.json_min2.gz
(Reporter)

Comment 15

3 years ago
Created attachment 8759097 [details]
memory.png

Updated

3 years ago
Flags: needinfo?(smayoral)
Whiteboard: [MemShrink][needinfo reporter 6/1/16] → [MemShrink]
(Reporter)

Comment 16

3 years ago
I think we can close this issue, new version 47 works ok.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.