Firefox hangs with large ABE rule

Discussions about the Application Boundaries Enforcer (ABE) module
access2godzilla
Senior Member
Posts: 109
Joined: Sun May 20, 2012 5:09 pm

Firefox hangs with large ABE rule

Post by access2godzilla »

I have a rather large ABE rule generated from the hpHosts ATS list. However, it seems that with large ABE rules, Firefox's hangs whenever I try to open the error console, and I have to terminate Firefox manually.

What changes needed to the ABE rule so that the problem does not occur?
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20140212 Firefox/24.0 PaleMoon/24.3.2
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Firefox hangs with large ABE rule

Post by Thrawn »

Pastebin is reporting that that paste has been removed?

I wouldn't suggest using ABE as an ad/malware blocker this way. You might be able to, but there are much better tools for the job, like ABP.

But if the size of the ABE messages in the console is the issue, you could simply try splitting it into multiple rules.
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:27.0) Gecko/20100101 Firefox/27.0
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Firefox hangs with large ABE rule

Post by Giorgio Maone »

Each "Site ..." uses an AddressMatcher object which in turn gets compiled to a rather unoptimized regular expression, unless, of course, it's recognized itself as a single regular expression literal: you can force this recognition by starting the expression with the "^" character.
Therefore, the best way to "import" an external list as an ABE rule is making your import script transform it into one single, possibly optimized regular expression and feeding it to a single "Site ..." clause.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
access2godzilla
Senior Member
Posts: 109
Joined: Sun May 20, 2012 5:09 pm

Re: Firefox hangs with large ABE rule

Post by access2godzilla »

I wrote a "converter" based on Giorgio's hints (thanks!). However, Noscript doesn't seem satisfied with the regex and gives an error: "line 2:6 no viable alternative at character '?'".

The converter: http://pastebin.com/2upXX3yd
The generated rule, run on hpHosts ATS: http://pastebin.com/9LFHJ266

What could be the problem now? Something in my code? Something in the Regexp::Assemble module?
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20140220 Firefox/24.0 PaleMoon/24.4.0b2
User avatar
Giorgio Maone
Site Admin
Posts: 9454
Joined: Wed Mar 18, 2009 11:22 pm
Location: Palermo - Italy
Contact:

Re: Firefox hangs with large ABE rule

Post by Giorgio Maone »

ABE recognizes as regular expressions clause arguments starting with "^", so just prepend a "^" character to your optimized expression.
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
access2godzilla
Senior Member
Posts: 109
Joined: Sun May 20, 2012 5:09 pm

Re: Firefox hangs with large ABE rule

Post by access2godzilla »

I made the necessary modifications to the above script (and consequently the generated rule also changed); I've edited the pastebin content to reflect this. Thanks for the pointers, Giorgio.

I'm quite satisfied with the results; seems like I can use this as a lightweight ad-blocking tool on some of my older computers which poorly perform with ABP.
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20140220 Firefox/24.0 PaleMoon/24.4.0b2
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Firefox hangs with large ABE rule

Post by Thrawn »

Someone has beaten you to the idea.
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:27.0) Gecko/20100101 Firefox/27.0
access2godzilla
Senior Member
Posts: 109
Joined: Sun May 20, 2012 5:09 pm

Re: Firefox hangs with large ABE rule

Post by access2godzilla »

Thrawn wrote:Someone has beaten you to the idea.
You see, I'm not running to the patent office with that fifty line Perl script; and the main logic is the contribution of a person from stackoverflow, so even if I were to try to do so my hopes are dashed.

I'll have to see from where exactly they get their list, though.
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: Firefox hangs with large ABE rule

Post by Thrawn »

The addon page claims it's based on EasyList. I believe it's not quite as comprehensive, though. Speed is the key.

One possible 'best of both worlds' approach is mentioned here.
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:27.0) Gecko/20100101 Firefox/27.0
Post Reply