Open Bug 705492 Opened 14 years ago Updated 3 years ago

document.write frame causes 100% CPU

Categories

(Core :: Web Painting, defect)

8 Branch
x86_64
All
defect

Tracking

()

People

(Reporter: mozilla, Unassigned)

References

()

Details

(Keywords: reproducible, testcase)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Ubuntu; X11; Linux x86_64; rv:8.0) Gecko/20100101 Firefox/8.0 Build ID: 20111115183813 Steps to reproduce: i fill the content of a frame with document.write from within another frame. when you log in into the guest account on www.spacetrace.org, you see a message frame at the bottom, that is filled from within the small iframe on top of the message frame per document.write(). the page load indicator doesent stop spinning, although the page i fully loaded Actual results: page doesent stop loading and CPU usage goes up to 100% Expected results: not so much CPU usage and page should be loaded after some seconds
Component: DOM: Other → General
Product: Core → Firefox
See Also: → 705490
i use FF8 on ubuntu 11.10
> the page load indicator doesent stop spinning, although the page i fully loaded well, if you're still writing to the document using document.write, it isn't fully loaded. I don't see high cpu usage using Nightly on Linux. Profiling seems to show painting taking some time.
Component: General → Layout
Product: Firefox → Core
QA Contact: general → layout
yes, the page takes a while, but then its done after some 20 seconds. but it doesent stop spinning loading, though. document write is only used once and then nothing should happen. if i press ESC it stops loading and the CPU goes down to some 20%
i tried the nightly buld and its the same: it doesent stop loading. you i close all the subframes with the red buttons, it still has high CPU. Then when i press the green refresh button of the message screen iframe the loading stops and the CPU goes down 20% less
Did you try with a fresh profile or with all extensions disabled?
no, but i am sure, you did, and it's the same: the page doesent stop loading and your CPU goes up 20% or so. if you press ESC it goes down again. it is the same everywhere on all firefoxes, i ever tested the question is: what is firefox calculating there ? and other browsers like chrome dont?
This bug needs useful steps to reproduce....
Component: Layout → General
Keywords: qawanted
QA Contact: layout → general
steps are: 1. open www.spacetrace.org 2. log in as guest 3. see top: much cpu-load 4. press ESC 5. see top: less CPU-load the question is: what is it, that is stopped by ESC, and that is causing 20% CPU. something in the messages-frame at the bottom in the middle.
> 2. log in as guest So username "guest" and password also "guest"? Thank you! > what is it, that is stopped by ESC, and that is causing 20% CPU. Painting. Of both the throbber being animated in the tab and the various animated images in the page itself (which ESC also stops, if you note). The CPU load does mostly go away if I window[6].document.close() on the page; I'm not sure whether it really costs us that much to animate the throbber or whether it's some interaction with the in-page animated content causing the invalidation area to balloon.
Status: UNCONFIRMED → NEW
Component: General → Layout: View Rendering
Ever confirmed: true
Keywords: qawanted
QA Contact: general → layout.view-rendering
guestlogin is a link on the startpage so can you confirm this bug? chrome isnt showing this behaviour. there is no reason, why the loading should continue and use so much CPU for nothing
Looks like we invalidate reasonable bounds, the throbber in the tab, and the two throbbers on the page. Sometimes this means (on my Ubuntu machine) we get a paint event with one large rect containing all three of these (the OS must fluff out the region to its bounds). Whats the deal with the page never finishing loading but in Chrome it does; is that a bug in Firefox or in the page?
If you do document.write and never document.close() to close the "stream", Firefox has traditionally interpret that as the page is still loading.
Ruben, the loading should continue, imo; the page opened a document and hasn't closed it. In any case, there are existing discussions about that beheavior. But I agree it shouldn't take as much CPU as it seems to to paint the throbber and the animations.
so the loading thing is a philosophical thing. ok. but do you say, that just the throbber animation graphic in the tab is using 20% of my CPU? that would definitely be a bug! if not, then a page that is filled with document.write() but not closed with document.close() uses 20% of my CPU? just for waiting for more input? (there is nothing more written after the start) i will provide a special login, that doesent have all the graphics later today. i guess it still uses a lot of CPU
i provided a page without all the surrounding stuff for you with an extra parameter: steps are: 1. open www.spacetrace.org 2. log in as guest (use the link "Guest Access" on top) 3. add "&nostyle=1" to the resulting url 4. see top: much cpu-load 5. press ESC 6. see top: less CPU-load
i located the bug in firefox: this small html page uses 20% CPU: <html><body> <iframe name="a"></iframe> <script> a.document.write('test') </script> </html></body>
> but do you say, that just the throbber animation graphic in the tab is using 20% of my > CPU? I don't know about yours, but it's using 20% of _my_ CPU. The time is definitely all spent in painting according to my profiler; as you say the unclosed document is just waiting for input, which doesn't involve any CPU usage. And yes, I think this is totally broken. ccing some imagelib folks too.
Hmm... I actually don't see an increase in CPU with these pages, on the latest nightly. I'm at (consistently) about 20% CPU usage with the latest nightly, while it's running. I'll try FF8, as that was the case where this appears more broken, and see if I can replicate this.
(In reply to Scott Johnson (:jwir3) from comment #19) > Hmm... I actually don't see an increase in CPU with these pages, on the > latest nightly. I'm at (consistently) about 20% CPU usage with the latest > nightly, while it's running. Let me rephrase, because I don't think I was clear before. What I meant was that my *SYSTEM* was consistently at 20% CPU usage all the time. When I run Nightly on the example that you gave, the throbber does indeed continue, but the highest CPU usage (for FF only) I see is 16% on initial load of the page, then it drops to 8% for a few seconds, then to 0%. With the spacetrace example, it does consistently stay at 16%. So, there is probably a problem on that page that I can't replicate with the testcase you gave.
Attachment #577595 - Attachment mime type: text/plain → text/html
the problem still exists in FF10 with the test-case page: https://bug705492.bugzilla.mozilla.org/attachment.cgi?id=577595 isnt this easy to fix? it seems, that the loading-indicator uses so much CPU on my other Laptop the CPU stays at 15% until i press ESC, then it goes down to 0%
OS: Linux → All
That does seem a little high for CPU usage for one small animation. We should profile to see where we are spending that time.
the problem still exists in FF13
Component: Layout: View Rendering → Layout: Web Painting
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: