Closed Bug 588742 Opened 14 years ago Closed 8 years ago

Browser hangs with 100% CPU when "Load images automatically" is disabled

Categories

(Core :: Widget: Win32, defect)

x86
Windows 8
defect
Not set
major

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: server_3249, Unassigned)

References

()

Details

(Keywords: hang, perf)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8

Dear Mozilla,

When I go to some websites like http://news.cnet.com/8301-13924_3-20014058-64.html and if images are disabled globally, then the entire browser hangs, the CPU core runs at 100% and toolbars and menus are unresponsive and have big lag. The drop down menus on top (like "File") do not open, and have just an outline of the menu. I took a screenshot of this, but in that the menu outline is not showing up. Basically it's like an outline of the drop down with white inside. I can reproduce this problem *every time* I visit some sites like the one listed above, so I thought I should notify you about this bug. As soon as the tab with that site is closed, the browser instantly returns to normal.

I am using the Image-Show-Hide 0.2.8 extension to turn off my images from the toolbar as shown in the screenshot. I am also using some other extensions. Everything works fine on other sites. Sorry I couldn't find another site to replicate this, but it happens every time on some sites while all others work perfectly.

Reproducible: Always

Steps to Reproduce:
1. Turn off images
2. Go to http://news.cnet.com/8301-13924_3-20014058-64.html
3. 
Actual Results:  
Browser and tool bars freeze, CPU at full.

Expected Results:  
No hang/freeze..

Fast 2010 config 3 GHz, Core 2, 4GB etc.
Attached image Screenshot
1. Note the menu hang
2. Note that images were disabled
3. No freeze occurs if images are enabled.
Please try to attach a Stacklog of that Hang: https://developer.mozilla.org/en/How_to_get_a_stacktrace_with_WinDbg
Component: General → Extension Compatibility
Keywords: hang, stackwanted
QA Contact: general → extension.compatibility
I wouldn't be able to do it since it's a work computer and I am not that tech literate. Maybe someone else can do it, just uncheck "Load images automatically" under Firefox options and then go to that site.
Can someone please look into this? It happens on *all* news stories that are launched from http://news.cnet.com/ (click a story link to go to the page with the problem).
Component: Extension Compatibility → General
It has nothing to do with extensions (it happens even with no extensions installed), so I have removed it from that component and put it in General.
Keywords: stackwantedperf, top100
QA Contact: extension.compatibility → general
To get this right, by saying "Images disabled" you mean disabling the Loading of Images by using the "Options"/"Content" Setting (which is equal to changing permissions.default.image from "1" to "2" in "about:config")?

If yes, i only can confirm higher than usual CPU Usage Time - without UI blocking/hanging. But maybe this depends on the available CPU Power.
Yes, please see comment 3. Unless the tab is closed if you see task manager the Firefox process is at 50 in case of dual core. One core is at 100% if you see the performance tab and it remains that way unless you close the tab, when the problem is promptly resolved.
The Hang/High CPU Usage is gone when you block

http://js-kit.com/for/news.cnet.com/comments.js
http://static.ak.fbcdn.net/connect/xd_proxy.php

using e.g. a suitable Ad Blocker.
So now that you've identified this as a problem can you escalate it to confirmed status so that it can be fixed in the future? It should not be possible for any site to freeze up Firefox in such a way, no matter how it's coded.
Is anyone going to do something about this bug or not? I reported it a long time ago (seems it was a waste of time) and no one has cared to fix it . Mozilla seems to only care about future releases and new features. They don't bother fixing the bugs.
(In reply to comment #8)
> http://js-kit.com/for/news.cnet.com/comments.js
seems to be the Cause. Something in this Script causes/triggers high CPU Usage if Image Loading is not available (per 'Loading images automatically' diabled).

Reproduceable in http://hg.mozilla.org/mozilla-central/rev/f4ea6992e1c6, http://hg.mozilla.org/releases/mozilla-1.9.2/rev/b3d441310e5c and on 1.9.1 Branch.

server_3249@hotmail.com, since Disabling "Loading images automatically" is non-default this Issue is mitigated with Regard to the whole Userbase (Thus, maybe not for you, though).
Do you know of other Examples (Sites, Scripts Usage) showing the *exact* Symptoms?
Assignee: nobody → general
Severity: major → normal
Component: General → JavaScript Engine
Keywords: top100
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
This is just a bug in the web page, no?  The relevant web page code is this:

JSCC.prototype.appendAvatarImage = function(container, obj) {
...
	avatar.onerror = function() {
		this.onerror = null;
		self.appendAvatarImage(container);
	}
	avtCtrl.assembleAvatar(container, avatar);
}

and:

JSKAvatars.prototype.assembleAvatar = function(container, avatar) {
...
	if (avatar.onerror) {
		image.onerror = avatar.onerror;
	}
}

If image loading is turned off, then trying to load an image will fire its onerror handler, which in the case of this site will cause it to add another image to the document, with the same exact onerror handler.

Since error events fire async this doesn't hang the browser, in that we go out to the event loop between iterations of the above code.  But error events are also not throttled (nor do we want them to be, I think), so the CPU is pegged due to us processing the above as fast as we can.  This is no different from a web page appending lots of content off a timer explicitly, as far as I can see.

So given that, is the bug just about the UI being laggy?  Or something else?
Note, by the way that over here (with a Firefox 4 beta debug build, even running under a debugger, so way slower than any actual release build) I do see the pegged CPU but don't see any lag in interacting with the UI: switching tabs is instantaneous; opening menus is instantaneous.  Likewise with Firefox 3.6...  That may be an OS-specific difference (I'm on Mac) due to differences in how event loops work, though.  Over to Windows widgetry to see what things look like on Windows here.  But in general the right solution for the lag is https://wiki.mozilla.org/Electrolysis
Assignee: general → nobody
Component: JavaScript Engine → Widget: Win32
QA Contact: general → win32
It's just the "laggy Part".

Are there some Bugs open to mitigate such Situations/Symptoms?
Especially with Regard to our Competition (I just checked Opera & Chrome) what handle this better?
Arrg, midaired. Thanks.
I am facing the bug on another site, and filed a bug 787811 (seems a dup now). So as the situation stands now, the preference seems quite useless, because every now and then I encounter site where Firefox will consume 100% CPU and have to kill Firefox using Task Manager.

Is there a workaround, say using a addon, where I can pump in a placeholder image from a local file system. That way can keep the site happy, don't consume bandwidth downloading images on a low bandwidth device.

If such a workaround is possible :
1. Is there already such a addon available?
2. If not, any pointers on how one can be created? Do I need to intercept http-request? How do I pump in data from a local file into the http-request? How do I know if the request is for a image?
Severity: normal → major
OS: Windows XP → Windows 8
FYI, the above site loads fine for me with images turned off using FF22, and it is really a shame to have removed the option of turning off images from FF23 just because of an apparent problem with a poorly coded website. Browsers, though, and no program, should allow themselves to hang up or go to 100% resource use under any circumstances. I hope that FF24 will be released soon with both the option to turn off image loading and turn off javascript restored. Until both of those options are restored, I will not be updating FF, and will stick with 22, which includes those options.
Summary: Browser hangs with 100% CPU when images are disabled on some websites → Browser hangs with 100% CPU when "Load images automatically" is disabled
The reasons folks might want to disable image loading are :
1. Save on CPU and memory.
2. Save on bandwidth

Is there a safe option, where instead of completely disabling image loading and generating an error (which is what seems to be happening and causing badly behaved websites to cause CPU to spike 100%), just download enough of the image to extract the size (so that layout doesn't break), and not do the rest of the download/decoding.

That should solve most of the reasons users want this option.
There is not right now, but filing an imagelib bug for such an option might be a good idea...
I of course am not using Firefox until switching image loading and javascript on and off is restored as an option. In Chrome I have to click on a few things - options, scroll down, advanced, scroll down, click off/on, but infinitely better than Firefox. I only use Firefox when I need to and only version 22 which still has that option. There are some things that I can only do using Firefox. I need to switch javascript on and off a minimum of multiple times a day and often multiple times an hour, to bypass stupid websites that use stupid web tricks. Images I mostly shut off as a web developer to see what the alt tags look like for someone who is blind. Sometimes because a large image is hanging up the browser. A few people have signed up at https://www.facebook.com/groups/286813071461409 Hopefully the madness of removing the option will be reversed soon.
using permissions.default.image=2
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: