Issue metadata
Sign in to add a comment
|
Memory leak with WebSocket(arraybuffer) inside a Worker
Reported by
gvince...@gmail.com,
Sep 6 2017
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0 Steps to reproduce the problem: 1. Test Server : Send data 1,5 Mo each 30 ms without fragmentation 2. Browser : Receive data with a WebSocket instanciate inside a Worker with binarytype="arraybuffer" It's not necessay to implement the method onmessage to reproduce the problem What is the expected behavior? Memory must be stable like without worker What went wrong? Memory increase more and more after each garbaging up to 3,5 Go and the error page "aï aï aï" Did this work before? N/A Chrome version: 60.0.3112.113 64-bit Channel: stable OS Version: Windows 10 Flash Version: Shockwave Flash 26.0 r0
,
Sep 6 2017
,
Sep 7 2017
I suspect the same root cause as https://bugs.chromium.org/p/chromium/issues/detail?id=339480. I suspect the reason it only appears in a worker is that there are less other things going on in the worker that would trigger v8 garbage collection.
,
Sep 11 2017
See the attached files to reproduce the problem.
,
Sep 11 2017
Thank you for providing more feedback. Adding requester "kojii@chromium.org" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Sep 11 2017
#4: Thank you for the repro, handing this to the team for further investigations.
,
Sep 12 2017
Requesting someone from the respective team to take a look and help in further investigation
,
Sep 13 2017
,
Sep 19 2017
The NextAction date has arrived: 2017-09-19
,
Sep 28 2017
I reproduced with the supplied scripts on version 63.0.3223.8. However, when I removed the call to console.log from WebSocket.js the leak went away. This makes sense, as console.log() requires the browser to keep a reference to the data. Is there a way to reproduce this without console.log()?
,
Sep 29 2017
I reproduced the problem with Chrome 60 without console.log(). You need to wait. Memory increase more and more after each garbaging.
,
Sep 29 2017
Thank you for providing more feedback. Adding requester "ricea@chromium.org" to the cc list and removing "Needs-Feedback" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 6 2017
#11 Thanks for the update. I am trying to reproduce, without much success so far, but I will leave it going over the weekend.
,
Oct 10 2017
I left this running over the weekend with no noticeable memory leak. Chrome version 63.0.3230.0. I did initially have a problem with a memory leak on the server side, which I resolved by porting it to use the "ws" module. This was maybe an issue with my version of nodejs, as the memory leak was severe enough to use all memory in a few minutes. I've attached my modified server.js. I've also attached WebSocket.js, although the only change is to remove the console.log statement.
,
Oct 13 2017
I tried an alternative where the Worker sends the size of the received data back to the page and the page sums it. This time I ran it on 63.0.3227.0 overnight with LeakSanitizer enabled. There was an unrelated 2MB leak the nvidia drivers, and an unrelated 4KB leak caused by an issue with thread shutdown. After the page loads there is a gradual increase in memory consumption in both the browser process and the render process. After a few hours this reaches a steady state and doesn't increase further. The peak memory usage is about 300MB more than the initial memory usage. My hypothesis is that this is mostly due to memory fragmentation, and unavoidable given the amount of data in flight.
,
Oct 31 2017
The NextAction date has arrived: 2017-10-31
,
Nov 3 2017
Effectively, I can't reproduce with Chromium 62 but I have a question if i send the data to the main thread with a postMessage when this data will be free from the memory if the worker stay alive ?
,
Nov 6 2017
As long as the Worker no longer references the data, it can be collected as normal while the worker is still alive. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by kojii@chromium.org
, Sep 6 2017Components: -Blink Blink>Workers
Labels: Needs-Feedback
NextAction: 2017-09-19