Blocking causes 100% CPU Utilization?

Posting here is no longer possible, please use the forum of a filter list project, such as EasyList
Locked
HeffeD

Blocking causes 100% CPU Utilization?

Post by HeffeD »

I've encountered a curiosity that I don't understand.

If I go to the website notalwaysright.com with the EasyPrivacy filter enabled, the throbber continues to spin as long as I visit the site. Not a big deal, but this causes a core of my CPU to spike to 100% utilization which causes severe system lag. How is this possible? How can blocking something on a web site cause my CPU to spike? And of course, leaving the site, all is well again...

I've posted on the EasyList forum because it's their filter, but since I'm extremely curious how this is possible, I posted here as well in hopes Wladimir would have some ideas. (Not about the filter, but how blocking something could cause 100% CPU utilization)
User avatar
ziutek
Posts: 49
Joined: Sat Aug 08, 2009 10:18 am

Re: Blocking causes 100% CPU Utilization?

Post by ziutek »

The problem is this part of the page in question:

Code: Select all

<img src="http://www3.clustrmaps.com/counter/index2.php?url=http://notalwaysright.com" style="border:0px;"
  alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg"
  onError="this.onError=null; this.src='http://www2.clustrmaps.com/images/clustrmaps-back-soon.jpg'; document.getElementById('clustrMapsLink').href='http://www2.clustrmaps.com'" /> 
It enters infinite loop when neither of the two above images can be loaded, see Mozilla bug #494377.
Last edited by ziutek on Thu Sep 24, 2009 1:36 pm, edited 2 times in total.
asdf

Re: Blocking causes 100% CPU Utilization?

Post by asdf »

Does going into about:config and setting javascript.options.relimit to "true" help at all?
HeffeD

Re: Blocking causes 100% CPU Utilization?

Post by HeffeD »

@ Ziutek Hmmm... Interesting. Very odd behavior. Looking at the filter, AdBlock Plus just sits at counts hits while it's in this loop. Looks like EasyPrivacy needs to be modified.

@ Asdf No, that doesn't seem to make any difference.
User avatar
ziutek
Posts: 49
Joined: Sat Aug 08, 2009 10:18 am

Re: Blocking causes 100% CPU Utilization?

Post by ziutek »

Interestingly, whoever wrote this attempted (unsuccessfully) to prevent the infinite loop by using:

Code: Select all

this.onError=null;
The correct code would be:

Code: Select all

this.removeAttribute('onError');
HeffeD

Re: Blocking causes 100% CPU Utilization?

Post by HeffeD »

Due to a tip on the EasyList forum, I've created an exception for http://www2.clustrmaps.com/images/clust ... k-soon.jpg, which solves the CPU usage issue. Hopefully that doesn't negate the point of the filter. (Is the image also used for tracking purposes?)

Apparently the code is supplied by clustrmaps to those pages using the service, as there has been another example of this issue posted on the the EasyList forum with another web developer using the exact same code.
User avatar
ziutek
Posts: 49
Joined: Sat Aug 08, 2009 10:18 am

Re: Blocking causes 100% CPU Utilization?

Post by ziutek »

HeffeD wrote:Is the image also used for tracking purposes?
There is no reason why it wouldn't be.
Locked