Closed Bug 238935 Opened 20 years ago Closed 17 years ago

Flash uses 100% cpu

Categories

(Core Graveyard :: Plug-ins, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 341380

People

(Reporter: pascal, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040320 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040320 Firefox/0.8

The flash ad at the page makes firebird use 100% cpu.

Flash plugin: Shockwave Flash 7.0 r19
WinXP SP2 RC1 (Pentium 4M 1,7Ghz, Radeon 7500)

Reproducible: Always
Steps to Reproduce:
1.Install flash plugin if not already installed.
2. Visit the page and look at your cpu usage.

Actual Results:  
Cpu usage jumps to 100%.

Expected Results:  
Cpu usage should stay normal.
WFM Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b) Gecko/20040327
Firefox/0.8.0+

Pascal, try out a current build, create a new profile and test again please. I
had the same effect before some minutes by downgrading to an older version for
checking the first occurence. But now i upgradet to the current build and the
load of 100 percent is away.

-> QA
QA Contact: bugzilla
Tested with latest nightly: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.7b) Gecko/20040327 Firefox/0.8
With new profile I get a Google ad instead of the flash one, so no problem with
cpu usage.
With my old profile I get the flash ad and have the high cpu usage again.
You get this google ad when flash isn't installed. Please check before you open
the page that the Flash plugin is installed. Then the flash content will be visible.
http://bugzilla.mozilla.org/show_bug.cgi?id=238935
Tried it again. After some refreshes I get the flash ad and still have the same
problem.
I also tried the page in IE(6 SP2-RC1) and it has the same problem! So it looks
like this is a flah plugin problem or another strange incompatibility.
Which plugin version do you use and do you use Firefox installer build or zip?
I'm using the installer.
Cause I need daily FF builds I use zip. Currently I've Shockwave Flash 6.0 r79.
So it's could be a version bug of flash. You know where i could download the
needed plugin files without to install flash? So i could try out your build.
I don't know which files you need, else I would zip them and mail/upload.
Take a look into the plugin directory. I need all files whose contains swf32 or
flash. By example for 6.0 i have flashplayer.xpt and NPSWF32.dll. You can send
it to me directly.
Tried to downgrade to your version. (about:plugins now mentions 6.0 r79, but who
knows what other files/versions are left)
Still the same problem. :-(
WFM Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040210
Firefox/0.8 and Shockwave Flash 6.0 r79

Confirmed Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b)
Gecko/20040302 Firefox/0.8.0+ and Shockwave Flash 6.0 r79

Seems to be a bug which only appears with WinXP.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Confirming with Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7b)
Gecko/20040327 Firefox/0.8.0+ and Shockwave Flash 7.0 r14.

Not sure if it's a flash plugin bug or a mozilla bug.
Sorry, but CPU usage is still low for me : 0 to 4%.

Using my yesterday homemade build (Mozilla/5.0 (Windows; U; Windows NT 5.1;
en-US; rv:1.7b) Gecko/20040329 Firefox/0.8.0+ (MozJF)) with WinXP Sp2 rc1 and
Shockwave Flash 7.0 r19
WFM

Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8a) Gecko/20040417
Firefox/0.8.0+
I am really tempted to say this is a Flash issue (BTW let me first note my bias
against flash, at least for web uses). Flash is notorious for being a CPU hog,
whatever you do. Try the same pages with other non-Mozilla browsers and you will
see the same issues. On my Mac (G4 466Mhz) I can usually tell when I have a page
that contains flash, since the computer becomes slugish and when looking at the
CPU usage, the browser that has is loaded is showing high CPU usage. I also have
the same issue with my computer at work - P3 800Mhz, running Windows 2000. I
should also mention pages with 3 Flash based ads really hurt. Maybe if there was
a way to add the unix equivalent of 'nice' to plug-ins it could be a solution. I
should also note that the amount of CPU use will depend on general speed of your
computer - it will have a less of a hit on a more recent computer. Personally, I
see excessive Flash use as bad web design and an accessibility barrier - and
goes against the philosphy of the web (write once, read anywhere).
Works for me. No unusual high CPU-usage on this site.

- Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a) Gecko/20040503
Firefox/0.8.0+
- Macromedia Flash Player 7,0,19,0 
- Microsoft Windows 2000 Pro 5.00.2195 SP4
I've also experienced this; WinXP Home, SP2-RC2, Firefox 0.9. I wonder if this
is a bug between Firefox, SP2-RCs, and Flash; I can't reproduce this in Internet
Explorer, but it's common in Firefox when a Flash-ad is being displayed on the
page. I suggest this needs to be looked into further; IF it's a problem with
Firefox, it should block 1.0.
I also experience this bug, but only in Windows XP. It seems to occur
irregularly however, and is most likely to happen when there are more than one
embedded flash objects on a page. The CPU ramps up to 100%, and the processes
list shows that it is Firefox doing it. I've tried the same pages with Internet
Explorer and Konqueror and haven't had the issue, so I still think this must be
a Firefox bug. I first noticed it with 0.8, and was able to verify it with
0.9.1. Also, I can't cause the problem to occur on locally stored pages, only on
pages requested through the internet connection.

I'm currently building a website for a non-profit organization, and it often
shows the issue: http://www.tommytwisters.com/mrlight

As I said, it's an irregular occurrance, but you'll notice that when it starts
to happen, the initial flash animations will go incredibly slow. In WinXP, hit
ctrl-alt-del, choose the processes tab, and sort by CPU usage. Firefox will be
at the top. Even when the animations don't choke out, you'll be able to notice
an unusually high processor usage (60 percent or higher). IE only gives about 10
to 15 percent utilization on the same page.
I just confirmed that it still happens in 0.9.2.
I've been experiencing these Flash performance issues for some time now.
Today I looked into the problem, I removed *ALL* old Flash versions from my
WinXP system, installed Flash 7,0,19,0 for Mozilla 1.8a2, Firefox 0.9.2 and IE
6.0. I tested CPU load while browsing the following page: www.techno.cz/index.php.

Result: The CPU usage was at 100% in ALL THREE browsers, i.e., in Internet
Explorer too.

This is NOT a Mozilla bug.
I guess I should make a correction to my last post. Having tested the cpu usage
with a site full of Flash objects that make the cpu usage go up to 100% in all
available browsers didn't prove anything.

So I tried Mozilla and IE browsers to view the
http://www.tommytwisters.com/mrlight site mentioned in one of the previous
comments - Mozilla CPU then took the CPU usage up to around 75%, while IE
satisfied with 40%. 

So yes, the way Mozilla deals with Flash movies probably needs improvements, but
the reports of "sites with Flash that almost freeze Mozilla" are probably more
related to poorly coded swf movies.
After what Karel said, I went back and tried several things with Flash to see
what makes the biggest differences in CPU utilization. It is odd that Internet
explorer uses far less CPU than Firefox does, and I'm hoping that the Mozilla
team will find a way to improve that (as it's still an issue worth working on in
my opinion) - however, Karel is right, the Flash animation appears to be the
culprit. The two largest offenders in Flash animations are:
1) Framerate
2) Loops
Framerates that go over 30fps are being very heavy handed - twice as much in
Firefox as in IE. For every frame over about 50fps, there seems to be an
exponential increase in required CPU.
Loops aren't quite as big of a hit as Framerates are, but can be if programmed
poorly (or too small - meaning looping only a couple of frames repeatedly). They
also get worse if you increase the Framerate as well (go figure).

Although Flash certainly seems to be at fault here, I would still recommend that
the Mozilla team improve their integration with it somehow. Flash animations are
all over the web now, almost on every page you go to anymore. With Flash
developers programming for IE, and IE not using as much CPU to run them, those
animations are not going to be optimized well enough for Firefox; which in turn
will cause Firefox to appear slower in numerous cases. I for one am going to
develop all of my content (Flash and otherwise) using Firefox for my test
platform, but I'm not sure you'll be able to convince everyone else to do the same.
One more thing to add, which I've recently discovered. If a flash animation is
set to loop (meaning that the loop = "false" parameter is not set in the HTML
object code), this seems to ramp utilization up through the roof as well. Don't
loop unless it's absolutely necessary. Notice that this is a bit different from
the loops I wrote about in my previous posting.
I should note that Mozilla and Opera are likely using plugins for the Flash,
while Internet Explorer is using Active-X. This make is difficult to make a
direct comparison. Maybe the equivalent of 'nice' for plugins would be useful.
Flash animation (and gif animation) should be stopped if a page is not in
foreground.
On a similar note, if a flash movie is embedded in a div, and the div is set to
be invisible (style="visibility:hidden"), cpu usage goes up to 100%, when the
div is not hidden, cpu goes down to normal.
This is a pervasive problem.  I reported a similar bug for mozilla, around when
the mozilla 1.1 release was made.  I've checked, it still happens in mozilla
1.7.3  On both Win 2K and XP
The efect is not usually immmediate.  After a while of leaving a page with a
flash ad open CPU usage will max out.  if you're patient (I'm talking hours
here) http://news.com.com/ will produce the result.
Obviously this is a flash problem, but it has something to do with the way the
plug-in interacts with the browser.
(In reply to comment #26)
> Obviously this is a flash problem, but it has something to do with the way the
> plug-in interacts with the browser.

That's not easy to say. I tested my last URL (comment 25) with different
browsers and noticed following processor load:

Firefox:  50 - 70%
Mozilla:  38 - 52%
Opera:     6 - 17%
IE 6.0:    2 -  8%

IMO it's not a flash bug. Perhaps we should test other plugins for cpu load, so
that we can definitely say it's the plugin handling. 
Is it a plugin or an embedding problem, or are they the same? Embedded Java
applets not only use a lot of CPU time, but they continue to run in hidden
(minimized or in background tabs) windows, and leak through from inactive tabs
to active ones.

Firefox does seem particularly subject to uncontrolled CPU excursions. With
multiple flash banners on background tabs the browser can become non-responsive
for minutes on a G4/466. I don't get the same kind of problem in Safari or
Camino (perhaps the Camino code could be examined to see what could be done?).
Due to comment 28: OS/HW => ALL
OS: Windows XP → All
Hardware: PC → All
All I can add, is that with the 1.0 release I also experience this problem at
the site mentioned in comment #25. But I see it happen at many other sites as
well. The more flash animations, the more CPU usage.
A related observation from Firefox 1.0: when comparing a Flash ad that produces
a high CPU usage in both Internet explorer and Firefox (e.g. one with constant
scrolling of complex images or fonts), I noticed a marked difference when the ad
is scrolled off the screen, or the window is minimized:

 - In Internet explorer, the CPU usage goes down to near-zero (2-3%)
 - In Mozilla, the CPU usage goes down somewhat, but stays much higher (going
down from about 50% to 40% in the last example I tried)

I could reproduce this after restarting the browser and going straight to the
page (currently http://www.ct.heise.de/, but the ad is likely to change...).

The ad loaded directly into the browser
(http://gsorder.berlin.strato.de/banner/heise/heise_server.swf?clickTag=http://www.zanox-affiliate.de/ppc/?1662816C1391504197%26ULP%3D&clicktarget=_blank)
shows the same behaviour on minimizing, while in Internet Explorer minimizing
brings it down from 100% to 0%. 

(environment: PIII 700Mhz, Windows XP2, Flash 7)
*** Bug 274121 has been marked as a duplicate of this bug. ***
http://gsorder.berlin.strato.de/banner/heise...
 
With my Maschine I have 75% CPU-Load

(environment: AMD 800Mhz, SuSE Linux 9.1, Flash 7, Mozilla 1.7rv.)
(In reply to comment #31)

> The ad loaded directly into the browser
>
(http://gsorder.berlin.strato.de/banner/heise/heise_server.swf?clickTag=http://www.zanox-affiliate.de/ppc/?1662816C1391504197%26ULP%3D&clicktarget=_blank)
> shows the same behaviour on minimizing, while in Internet Explorer minimizing
> brings it down from 100% to 0%. 

Update on that: I just tried clicking the above link again (environment
unchanged from comment #31), and minimizing now does bring the load down to 0%,
as expected - which it didn't do when I originally tried it... that seems to
point to some external factor, at least regarding high CPU usage when a Flash
movie is off-screen.
Flags: blocking-aviary1.1?
I've seen this bug on and off now for quite awhile.  On my latest system, a
2.8ghz P4 flash doesn't use more than 50%.  On an older system it would
routinely use 100%.   The first flash that caused this effect on my system was a
G54 wireless animation.  Once I began adblocking animated flash the problem
became controllable.   I tried the same ad displayed and minimized and CPU went
to zero when the browser was minimized.  I have seen CPU usage remain high with
the browser minimized and with tabbed browsing I've seen the usage remain high
even when the ad appears on a hidden tab.  
Setting the TextArea component's enabled property to false in flash can cause 
CPU usage to go up to 100%. There was an issue with one of the components 
supplied with flash.

http://www.markme.com/flashteam/archives/005546.cfm
Component: General → Plug-ins
Product: Firefox → Core
Version: unspecified → 1.0 Branch
Assignee: firefox → nobody
QA Contact: bugzilla → plugins
Cause this not only happens on 1.0 branch builds I extend the version to trunk.
Confirmed with Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/20050316
Firefox/1.0+
Version: 1.0 Branch → Trunk
See bug 238935, that has a testcase. The flash leaks in both Firefox and IE. See
bug 238935, comment 2.
(In reply to comment #38)
> See bug 238935, that has a testcase. The flash leaks in both Firefox and IE. See
> bug 238935, comment 2.

Sorry, it shoud be:
See bug 246713, that has a testcase. The flash leaks in both Firefox and IE. See
bug 246713, comment 2.
*** Bug 295919 has been marked as a duplicate of this bug. ***
Flags: blocking-aviary1.1? → blocking-aviary1.1-
*** Bug 213913 has been marked as a duplicate of this bug. ***
*** Bug 256216 has been marked as a duplicate of this bug. ***
*** Bug 239602 has been marked as a duplicate of this bug. ***
It's OKAY for a Flash to use 100% CPU.

However, the application that hosts the Flash (i.e. the browser) should control
how responsive the application appears.

Right now, a rogue Flash ad (e.g. try visiting FileFront.com and download a
file, you'll see a flash ad that appears like a text ad, but is actually a
flash) can makes the rest of the Firefox UI unusable - i.e. you cannot even
switch to another tab while the Flash slaughters your CPU.  It is unacceptable.

The same Flash runs in IE and the browser remains responsive (mind you, the
Flash still takes 100% CPU in IE) - If I do some other things to the computer
that takes CPU, the Flash would slow down - but not the entire browser.

In other words, Firefox is not properly utilizing threading and giving them
user-friendly priorities.

IMHO accepting user commands at the UI should take the highest priority,
trumping anything including animated GIF, Flash, Javascript, etc.  This way, we
can ensure at least the browser remains *somewhat* responsive regardless of how
hungry a Flash is.

The solution should be separating the UI thread, the HTML rendering thread, the
plugin threads, the script threads (as much as possible) and then give the UI
thread a higher priority and the Flash plugin thread a higher niceness.

*** Bug 318148 has been marked as a duplicate of this bug. ***
Umm, wy2lam's expectation of how Firefox should handle this is .... flawed.  This thread gets the same priority as most other threads in the system, and it's the Windows scheduler - NOT Firefox - which is not giving your other processes enough CPU time to keep you happy.  Try messing about with your system quanta and increase the number of clock ticks that this will remain on the system for (and also give your other apps a similar amount of CPU time to work), or drop the process priority of Firefox or this thread.

I have more information from a duplicate bug which I created.  The stack of the thread which is taking up most of the CPU time in this case switches between 

this (with varying numbers of NPSWF32.dlls in the stack):
ntoskrnl.exe!KiDispatchInterrupt+0x7f
NPSWF32.dll+0x4b022

and this:
ntoskrnl.exe!ExReleaseResourceLite+0x206
win32k.sys+0x2fa0
win32k.sys+0x37a6
win32k.sys+0x37c3
ntdll.dll!KiFastSystemCallRet
appshell.dll+0x8043
mozilla.exe+0x1969
mozilla.exe+0x2d2e
kernel32.dll!RegisterWaitForInputIdle+0x49

Most details for my experience of this (in a different URL) are in the previously close duplicate bug, but in short:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915
(ie, xp pro sp2, mozilla 1.7.12).  I may have "wierdness" in my environment by running as non-admin with a seriously restricted subset of normal windows services, but judging by the number of others with this issue, it's not just me.
*** Bug 323552 has been marked as a duplicate of this bug. ***
also seems to be the cause of my trouble when visiting this page:
http://java.sys-con.com/read/185647.htm

Using MacOS X 10.4.5 with Firefox 1.5.0.1, Flash-plugin 7.0r24. Will try with 8.5a.

The page loads in heavily, and at some point, when it says "Transferring from vital.flash.com" or similar, the browser completely hangs and the only way is to kill it (I have waited 5 minutes or so, browser becomes available for a fraction of a second, but immediately goes busy again).
Also recent reproduction by going here:

http://labs.live.com/photosynth/video.html (Though this one is not a flash).

*** Bug 351411 has been marked as a duplicate of this bug. ***
An interesting observation, in Firefox 2 (RC1, XP) :
I am just having the bug, but when I ask to switch to another tab by choosing it on the right menu from the tab bar, I can get there ! (while by pressing the tab it still does not respond)
*** Bug 348435 has been marked as a duplicate of this bug. ***
(In reply to comment #52)
> *** Bug 348435 has been marked as a duplicate of this bug. ***
> 

50-80% CPU usage at http://www.evanescence.com/video.asp
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060924 Minefield/3.0a1 ID:2006092404 [cairo]
I'm not familiar with the mozilla source, so I'm only guessing based on using Shark on Camino during one of those periods when the CPU hits 100%.

It looks like the UI is repainting the nsView way too fast. I don't know if that's a requirement of the plug-in API, but it seems like you could cap that amount. Right now, it appears to be repainting faster then the screen refresh rate.
I want to add a comment about the thread priorities of the Flash plugin.  Please let me know if I should open a new bug about this.

On my system (Linux), I occasionally have a CPU-intensive process running at the lowest priority ("nice +19").  When such a process is running, Seamonkey hangs when it's trying to load and render Flash content.  As soon as I kill that process, Seamonkey continues and loads everything fine.

Therefore, I think the Flash plugin is operating at the same priority, which I think is wrong.  No thread with which the user is currently interacting should run at the lowest priority, because that interferes with background processes that were designed to run without interfering the user's regular tasks.
*** Bug 358830 has been marked as a duplicate of this bug. ***
QUOTE
 ------- Comment #51 From Christian Tanguy  2006-09-24 12:54 PST  [reply] -------

An interesting observation, in Firefox 2 (RC1, XP) :
I am just having the bug, but when I ask to switch to another tab by choosing
it on the right menu from the tab bar, I can get there ! (while by pressing the
tab it still does not respond)
END QUOTE
----------------------------------------------------------------------------------
I also have this issue when using similar flash sites with an older machine say a PII.  I am running a P4 3.0 GHZ and that site above consumer almost 50% which is not right.  Adobe need to rethink their plugin since IE is much better and works properly.
CC'ing Michelle Sintov from macromedia who could help us.
Hi.
Since I installed SeaMonkey 1.0.6 it seems the browser is sometimes slower (than Seamonkey 1.0.5).
I find this bug and wrote you my comments.
I looked after the CPU load after visit www.adobe.com (flash ads).
With this page, my CPU load increases to about 40% (AMD 1700+, 1Go RAM), about twice as IE6 for the same page. 
I'll will came back to 1.0.5 at work to try.
Pascal - tigroo92@yahoo.fr

SeaMonkey 1.0.6 Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR; rv:1.8.0.8) Gecko/20061030
(In reply to comment #0)
i think we should stay focused on the exact bug we're trying to track, here.  the original URL from 3/04 is still valid and uses a lot of cycles, but i'm not convinced that either adobe/macromedia or the mozilla plugin architecture should be blamed.  the same page (with 16 flash animations!) causes heavy (though not as heavy) CPU usage with IE7 and the flash 9 OCX.

i'm tempted to just blame the page designers, at this point.  if the reporter or somebody else wants to contact them and see if they've found something in particular that causes what they feel to be inordinate CPU usage, i'm sure michelle will be happy to bring this to the attention of the flash dev team.

otherwise, i think we should just mark this bug as invalid and others can open new bugs if they know some particular flash animation that seems to be causing the mozilla flash plugin to spin.
Duplicate of bug 341380.
(In reply to comment #61)
> Duplicate of bug 341380.

Indeed, opaque is specified. duping

not a hang and 100% cpu...is not critical
Severity: critical → major
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.