Closed Bug 421643 Opened 16 years ago Closed 15 years ago

Flash spikes CPU Usage in Firefox but not IE

Categories

(Core Graveyard :: Plug-ins, defect)

x86
Windows XP
defect
Not set
major

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: pnadhani, Unassigned)

References

()

Details

(Keywords: perf)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12

If you open this page in Firefox, the CPU spikes up abnormally:
http://www.fusioncharts.com/test/MemCheck/Index.html

Open the same page in IE and the CPU stays at 0. We're pretty sure that there are no leaks in our code (infact, CPU at 0 in IE says that).

Reproducible: Always

Steps to Reproduce:
1. Go to this page.
2. Scroll down so that all charts render.
3. See the spike
Actual Results:  
CPU Usage Spikes up

Expected Results:  
CPU should have stayed normal after the charts have been rendered.

I had firebug installed - which I disabled.
Flash player version is 9.0.45
There's definitely something weird going on with the Flash plugin or the contents of that page. I don't think it's necessarily related to Firefox, but I'll tentatively confirm. I agree with your rating of severe, because it basically means you have to close Firefox.

Firefox 2.0.0.14pre: Page finishes loading, high CPU load, never recovers. Browser window locks up after a while. Had to close with Task Manager.

Firefox 3.0pre: Page finishes loading, high CPU load, never recovers. Browser window locks up, although I was able to close it without Task Manager.

Safari 3.1 (win32): Page doesn't even finish loading, high CPU load, browser window becomes completely unresponsive, had to close with Task Manager.

Opera 9.50 beta: Up to 30% CPU load while loading the page, then drops off to ~0-2%.

IE7: Much higher CPU load while loading (~100%), then immediately drops off to ~0-2%.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: unspecified → Trunk
FWIW, I have Flash 9.0 r115.
File name: NPSWF32.dll
Shockwave Flash 9.0 r124

Same issue.  But notice when CPU is high, there's lots of disk activity.  Virtual memory doesn't seem to be running away.
I don't know that fixing this should necessarily block FF3, but it's possible that investigating more to understand what's going on here might...
Flags: blocking-firefox3?
See comments in bug 426945 -- related?
(In reply to comment #3)
> File name: NPSWF32.dll
> Shockwave Flash 9.0 r124
> 
> Same issue.  But notice when CPU is high, there's lots of disk activity. 
> Virtual memory doesn't seem to be running away.
> 

Same issue and same version of flash in FF 2.0.0.14, but I didn't see any disk activity.  I did manage to close the tab using CTRL-W.  Once I did so the CPU usage dropped back down to 0.  I'd say it's probably an issue with the Flash plugin.

I tried Opera 9.27 and originally it did not experience this problem, but I managed to recreate the problem in Opera by opening the help pulldown menu and leaving it open a short while.

I used process explorer to dump the call stack of the FF and Opera threads that were using all of the CPU.  I also dumped the stack for Opera when it wasn't having the issue.

Here's FF 2.0.0.14:
ntkrnlpa.exe+0x69d3f
ntkrnlpa.exe!PsLookupThreadByThreadId+0x4abc
ntkrnlpa.exe!KiDeliverApc+0xb3
hal.dll+0x2c35
hal.dll!ExReleaseFastMutex+0x25
ntkrnlpa.exe!KeReleaseInStackQueuedSpinLockFromDpcLevel+0xb14
ntdll.dll!KiFastSystemCallRet
kernel32.dll!VirtualQuery+0x15
kernel32.dll!SetThreadContext+0x44
kernel32.dll!SetUnhandledExceptionFilter+0x2b
NPSWF32.dll!native_ShockwaveFlash_TCallLabel+0x743d


Here's Opera 9.27 when it did not have the problem:
ntkrnlpa.exe+0x69d3f
ntkrnlpa.exe!PsLookupThreadByThreadId+0x4abc
ntkrnlpa.exe!KiDeliverApc+0xb3
ntkrnlpa.exe!ZwYieldExecution+0x1974
ntkrnlpa.exe!NtWaitForSingleObject+0x9a
ntkrnlpa.exe!KeReleaseInStackQueuedSpinLockFromDpcLevel+0xb14
ntdll.dll!KiFastSystemCallRet
kernel32.dll!WaitForSingleObject+0x12
NPSWF32.dll!native_ShockwaveFlash_TCallLabel+0x3ec9e


Here's Opera when it did have the problem (it actually stopped responding):
ntkrnlpa.exe+0x69d3f
ntkrnlpa.exe!PsLookupThreadByThreadId+0x4abc
ntkrnlpa.exe!KiDeliverApc+0xb3
hal.dll+0x2c35
hal.dll!ExReleaseFastMutex+0x25
ntkrnlpa.exe!KeReleaseInStackQueuedSpinLockFromDpcLevel+0xb14
ntdll.dll!KiFastSystemCallRet
kernel32.dll!VirtualQuery+0x15
kernel32.dll!SetThreadContext+0x44
kernel32.dll!SetUnhandledExceptionFilter+0x2b
NPSWF32.dll!native_ShockwaveFlash_TCallLabel+0x743d


As you can see the thread stack in Opera looks nearly identical to the FF one when Opera started using 99% CPU.  The main difference I see is the call to hal.dll.  Since it's using hal.dll I'll mention my test machine has a NVideo Geforce Go 6800.
I meant NVidia not NVideo.  This is under Windows XP SP2.  And for the sake of completeness here's IE 7.0 SP2's thread stack.  It doesn't use the plugin, so I don't know how useful it will be, but it matches the stack track for Opera when Opera does not demonstrate the problem.

IE 7.0 SP2 (no problems):
ntkrnlpa.exe+0x69d3f
ntkrnlpa.exe!PsLookupThreadByThreadId+0x4abc
ntkrnlpa.exe!KiDeliverApc+0xb3
ntkrnlpa.exe!ZwYieldExecution+0x1974
ntkrnlpa.exe!NtWaitForSingleObject+0x9a
ntkrnlpa.exe!KeReleaseInStackQueuedSpinLockFromDpcLevel+0xb14
ntdll.dll!KiFastSystemCallRet
kernel32.dll!WaitForSingleObject+0x12
Flash9f.ocx!DllUnregisterServer+0x55d31
Not a regression, so not blocking. Can PW (https://addons.mozilla.org/en-US/firefox/addon/7055) help figure things out here?

-->Core::Plugins
Component: General → Plug-ins
Flags: blocking-firefox3?
Product: Firefox → Core
QA Contact: general → plugins
Flags: wanted1.9.0.x?
Flags: wanted-next+
I see this issue also, but I can get it to go away in FF2 by changing the Flash Player wmode, as in:

	    var wmode = 'window';
            if(Ext.isIE)
               wmode = 'opaque';

Unfortunately, this fix is not working in FF3.
How can we rule out viewport interactions? I'm totally ignorant of the plugin API on how flash is allocated a window within FF so I may be blowing smoke, but IIRC a long time ago there was some funky call-back stuff going on which was the casue of some earlier related problem.
I also have this problem.
It's very annoying, when I open a site with flash, Firefox will take 100% of my CPU. And I think 80% of the most viewed sites using flash. I think this is a *BIG* problem for all the FF users.
I just tested Opera 9.5 and I see that it uses 99% CPU on that page as well.  The interesting thing is that Opera remains responsive despite the fact that it is using 99% CPU.  I can open new tabs, navigate menus, etc.

I then tested Firefox 3.0. It too uses 99% CPU, but Firefox 3.0 is no where near as responsive as Opera.  Interaction with the browser remains responsive until I click something that causes a GUI update such as opening a new window or menu (context or popup).  In this case the outline of the window/menu will display, but won't be filled in.  Even trying to close the browser using the close button in the title bar does nothing.  I can close the problem page using the close tab button and everything returns to normal.

I tested using the Plugin Watcher addon (which needs to have it's max version updated) and found that while Firefox was using 99% of the CPU, the PW showed no bars meaning that it thought there was no load in the plugin.  The PW addon was working though because when I went to another page that contained Flash, it displayed 1 or 2 bar which is a low load.  I had the problem page still running in another tab at that time.

So the problem is definitely with the Flash Plugin.  Has anyone tested with the Flash 10 beta plugin and see if this is still a problem?

http://labs.adobe.com/technologies/flashplayer10/
(In reply to comment #0)
> User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12)
> Gecko/20080201 Firefox/2.0.0.12
> Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12)
> Gecko/20080201 Firefox/2.0.0.12
> 
> If you open this page in Firefox, the CPU spikes up abnormally:
> http://www.fusioncharts.com/test/MemCheck/Index.html
> 
> Open the same page in IE and the CPU stays at 0. We're pretty sure that there
> are no leaks in our code (infact, CPU at 0 in IE says that).
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1. Go to this page.
> 2. Scroll down so that all charts render.
> 3. See the spike
> Actual Results:  
> CPU Usage Spikes up
> 
> Expected Results:  
> CPU should have stayed normal after the charts have been rendered.
> 
> I had firebug installed - which I disabled.
> Flash player version is 9.0.45
> 

I use fusionchart to create dashboard and reporting in my company.

I had this problem but I'd fixed it, It seems that is due to the fps of the swf files.

1. Install the PEAR Package.

2. Install the FILE PEAR PACKAGE.

3. Download the PEAR::File class here : http://www.sephiroth.it/weblog/archives/2004/07/pearswf_updating_read_and_modify_swf.php

4. Include the class to your php file.

5. Here's the script I use :

I test if my new swf file exist, if doesn't I create new one with the old one and a 20fps.

if(!file_exists('../flashes/packing_by_agency.swf'))
{
	$flash = new File_SWF("../flashes/Doughnut2D.swf");
	if($flash->is_valid())
	{
		$flash->setFrameRate(20);
		$flash->write("../flashes/packing_by_agency.swf", 1);
	}
}

For 35 to 45 swf in the same web page : 

- Before this I have always a cpu ~45-55%.

- Now I have always a cpu ~00-05%.

N.B. : It's better if the wmode is not transparent.


This should get looked at in 1.9.1 at the very least, but not wanted for 1.9.0.x since anything with changing our plug-in code is likely to be dangerous.
Flags: wanted1.9.1?
Flags: wanted1.9.0.x?
Flags: wanted1.9.0.x-
Flags: blocking1.9.1?
This is likely a problem in the NPAPI flash plugin (which is somewhat different from the IE ActiveX plugin), especially given that the problem shows up in Opera as well as Firefox. Michelle, any thoughts here?
And removing nominations until this is confirmed to be a bug on our end.
Flags: wanted1.9.1?
Flags: blocking1.9.1?
(In reply to comment #15)
> This is likely a problem in the NPAPI flash plugin (which is somewhat different
> from the IE ActiveX plugin), especially given that the problem shows up in
> Opera as well as Firefox. Michelle, any thoughts here?

I agree that the problem is with the flash plugin since both Firefox and Opera see high CPU usage, but Opera remains responsive while Firefox does not.  So Firefox is partially to blame as well.
Does this problem still happen with the Flash Player 10 release? http://adobe.com/go/getflashplayer
(In reply to comment #18)
> Does this problem still happen with the Flash Player 10 release?
> http://adobe.com/go/getflashplayer

I just installed Release 10 for FireFox 3.0.3. I visited 2 sites that consistently peg my CPU at 100% because of the flash content. I have found that they no longer do this. 

Rich
I'm not seeing high CPU usage either.  It hovers around 25% on my CPU, but the page remains responsive so I'd say this bug is no longer an issue with Flash 10.
I had 2 weeks of bliss until the problem started appearing again. I noticed after installing Release 10 that some flash content did not appear in my browser. I checked that this content did appear on another computer running Flash 9. I assumed that it was an incompatibility with the swf and Flash 10. 

This week, I have noticed that the content that previously did appear in Flash 10 now is showing. I assume that the content was updated to be compatible with Flash 10. Unfortunately, 

I am now seeing the CPU spikes again using Flash 10. I believe the once incompatible content is responsible for the spikes now...
see this also with FF beta and current flash v10?
 http://www.mozilla.com/en-US/firefox/all-beta.html

WFM - a second at 50% cpu then idles near zero
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b3) Gecko/20090305 Firefox/3.1b3
and Shockwave Flash 10.0 r22

high cpu <> critical
Severity: critical → major
Keywords: perf
=> WFM per comment 20, 22
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.