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

Issue 796878 link

Starred by 6 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug



Sign in to add a comment

iframe memory leaks

Reported by a...@teamstats.net, Dec 21 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36

Steps to reproduce the problem:
1. Go to https://www.teamstats.net/leak-test.html
2. Observe page showing 4 iframes that load another document that only contains a static image. 
3. Observe iframe src being cleared and then same document reloaded every 4 seconds.
4. Observe memory usage continually grow in Task Manager

What is the expected behavior?
Memory should be released and Garbage Collected

What went wrong?
Memory usage increases indefnitely, eventually crashing browser tab.

Did this work before? No 

Chrome version: 63.0.3239.84  Channel: n/a
OS Version: OS X 10.12.6
Flash Version: Shockwave Flash 28.0 r0

This is a simplified demo, I used 4 instances of the iframe to speed up the demonstration of the increase in memory usage.

 Issue 609137  describes the same problem but the author claimed it had been fixed, unfortunately it hasn't.
 

Comment 1 by a...@teamstats.net, Dec 21 2017

I should add that our intended use case for this is displaying Google ads in a single page application. This issue means we are unable to proceed. 

Comment 2 by a...@teamstats.net, Dec 21 2017

It seems upon further testing that the memory usage for the url provided seems to top out between 550-580MB and stays in that range. 

For a more real world usage that doesn't stop at 550MB please see https://www.teamstats.net/ad-leak-test.html which loads adverts in and refreshes at timed intervals.

Comment 3 by naege...@gmail.com, Dec 21 2017

We see this happening as well and considering google's extensive use of iframes in their ad serving products (think DFP, Adsense, etc) I would hope this becomes a high priority for them.
Labels: Needs-Triage-M63
Components: -Blink Blink>MemoryAllocator
Labels: -Pri-2 M-64 Pri-1
Unable to reproduce the issue on reported chrome version 63.0.3239.84 and on the latest canary 65.0.3305.0 using Windows 10 with the below mentioned steps.
1) Launched Chrome reported version
2) Navigated to URL: https://www.teamstats.net/leak-test.html
3) Page loads with four iframes which reloads every 4 seconds
4) Opened task manager and observed meory usage
5) Memory increases and one point it remains constant and page didn't got crashed

@Reporter: Please have a look at the attached screen cast and let us know whether we have missed any steps in reproduicng the issue, try to test this issue by creating new person which don't have any apps or extensions in it and let us know if the issue still persists.

Thanks!
796878.mp4
2.2 MB View Download
Cc: viswatej...@techmahindra.com sc00335...@techmahindra.com
Labels: Needs-Feedback Triaged-ET

Comment 8 by naege...@gmail.com, Dec 29 2017

The issue had nothing to do with crashes but rather with memory leakage. The Screencast does not do anything to test or measure garbage collection. Suggest you escalate this to a dev who has experience diagnosing memory leaks. 

Comment 9 by a...@teamstats.net, Dec 29 2017

As the previous poster rightly says, the crashes I have experienced are as a result of memory leaks which are the issue here. I did note in the comments following my initial report that the memory usage stopped in the original test, but when loading more intensive content it did not.

Regardless of a crash occurring, it is clear that memory is being allocated and not reclaimed when it should be. Your screencast does not actually show the memory usage stabilise, but it does show the amount of memory continue to grow.
Project Member

Comment 10 by sheriffbot@chromium.org, Dec 29 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "sc00335628@techmahindra.com" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
I'm able to recreate this issue.
We are having a very similar problem with iframes leaking memory.

Using the test given memory usage for the tabs process went over 1GB within 10 minutes.
Forcing garbage collector to run using dev tools brings the private memory down to ~200MB and the total memory for the tab to ~250MB.

I believe the unique image src tags are causing the images to be cached and are never cleared.

Adding the sandbox attribute to the iframes causes javascript to no longer run on the sub-frames which fixes the issue.
If you add sandbox="allow-scripts" the issue returns. I did not allow cross origin - so we know no DOM nodes are being referenced cross-frame.

What's very interesting and what I believe shows this is a chrome issue is all memory snapshots and recordings show the same number of documents, JS memory, DOM Nodes, and DOM Listeners before and after the memory leak (See attached images).



Google Chrome	63.0.3239.132 (Official Build) (64-bit) (cohort: 63_win_132)
Revision	2e6edcfee630baa3775f37cb11796b1603a64360-refs/branch-heads/3239@{#709}
OS	Windows
JavaScript	V8 6.3.292.49
Flash	28.0.0.126
User Agent	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36

memoryLeakCapture.PNG
20.0 KB View Download
memoryLeakCaptureDescription.PNG
113 KB View Download
Cc: guidou@chromium.org
As per comment#8 and #9, could someone from Blink>MemoryAllocator team take a look into this issue.

Thanks!
Labels: TE-NeedsTriageHelp
I'm experiencing a similar issue with iframes. The script tags loaded inside the iframes are not being released from the memory. we use iframes to display ads in our product. Any solution to this problem? I'm using the latest build Version 65.0.3325.181 (Official Build) (64-bit)
Running into this issue as well when rendering ads in iframes in a SPA.  Crashes around 7 minutes into the session.  I have a heap snapshot of a failed session if that's useful, but it's 1.4gb so i'll upload it if it's useful to a dev.

Chrome Version 65.0.3325.181 (Official Build) (64-bit)
Cc: kinuko@chromium.org
Components: -Blink>MemoryAllocator Blink>Loader
Labels: Performance-Memory
I don't think this is a bug in the allocator, rather it's a memory leak in Blink, related to iframes/images. Tentatively, I am a little suspicious about an ongoing experiment keeping resources alive in-memory  for subsequent navigations (SavePreviousDocumentResources).

+kinuko could this be related? I'm not sure if this experiment was enabled in M65 (per c#15).
Cc: yhirano@chromium.org
I can't reproduce the issue with https://www.teamstats.net/leak-test.html.
Cc: haraken@chromium.org yuzus@chromium.org
Owner: yuzus@chromium.org
yuzus: Would you help us triage here, or would you mind taking a look?
Status: Assigned (was: Unconfirmed)

Sign in to add a comment