New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 762466 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: 2017-10-31
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Memory leak with WebSocket(arraybuffer) inside a Worker

Reported by gvince...@gmail.com, Sep 6 2017

Issue description

UserAgent: 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
 

Comment 1 by kojii@chromium.org, Sep 6 2017

Cc: kojii@chromium.org
Components: -Blink Blink>Workers
Labels: Needs-Feedback
NextAction: 2017-09-19
Thank you for reporting the problem to us.

Do you have reproducible files? It helps us to understand the problem better if we can reproduce.
Components: Blink>Network>WebSockets

Comment 3 by ricea@chromium.org, 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.

Comment 4 by gvince...@gmail.com, Sep 11 2017

See the attached files to reproduce the problem.
WebSocket.js
134 bytes View Download
Worker.html
158 bytes View Download
server.js
693 bytes View Download
Project Member

Comment 5 by sheriffbot@chromium.org, Sep 11 2017

Labels: -Needs-Feedback
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

Comment 6 by kojii@chromium.org, Sep 11 2017

Cc: -kojii@chromium.org
Components: -Blink>Workers
#4: Thank you for the repro, handing this to the team for further investigations.
Cc: sc00335...@techmahindra.com
Labels: Needs-Milestone Triaged-ET
Requesting someone from the respective team to take a look and help in further investigation
Cc: yukishiino@chromium.org
The NextAction date has arrived: 2017-09-19

Comment 10 by ricea@chromium.org, Sep 28 2017

Labels: Needs-Feedback
NextAction: 2017-10-31
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()?
I reproduced the problem with Chrome 60 without console.log(). You need to wait.
Memory increase more and more after each garbaging.
Project Member

Comment 12 by sheriffbot@chromium.org, Sep 29 2017

Cc: ricea@chromium.org
Labels: -Needs-Feedback
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
#11 Thanks for the update. I am trying to reproduce, without much success so far, but I will leave it going over the weekend.

Comment 14 by ricea@chromium.org, 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.
server.js
547 bytes View Download
WebSocket.js
111 bytes View Download

Comment 15 by ricea@chromium.org, Oct 13 2017

Status: WontFix (was: Unconfirmed)
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.
The NextAction date has arrived: 2017-10-31
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 ?
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