You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2005/08/30 14:38:48 UTC

[Bug 4562] New: Excessive backtracking in UNRESOLVED_TEMPLATE head rule

http://bugzilla.spamassassin.org/show_bug.cgi?id=4562

           Summary: Excessive backtracking in UNRESOLVED_TEMPLATE head rule
           Product: Spamassassin
           Version: 3.0.4
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Rules
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: eriker-sa@f-secure.com


The UNRESOLVED_TEMPLATE regular expression causes a lot of backtracking in some
messages.

To repro, try running it on the first ten messages in easy_ham in the public
corpus, e.g. with the speedtest tool. In my tests (admittedly with some hacks of
my own in place), the Perl profiler indicates that this rule alone accounts for
several per cent of the overall processing; significantly more than any other
individual rule.

 vnix$ perl -d:DProf speedtest easy_ham/0000*
 vnix$ dprofpp -O 10000 | grep -C1 '_test$'  # inexact; dprofpp wraps lines

With a simple change to the rule, the backtracking can be avoided; here is a
pseudo-diff in m//x syntax:

 ^
 (?!(?i:X-UIDL|X-Face|To|Cc|From|Subject|References|In-Reply-To|
  (?:X-|Resent-|X-Original-)?Message-Id):)
 [\w-]{1,24}:
-(?:[^\n]{0,100}|\n[ \t]){0,2}
+(?:.{0,100}\n[ \t]){0,2}?.{0,100}
 %[A-Z][A-Z_-]

The change from [^\n] to . is not strictly necessary, of course.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4562] Excessive backtracking in UNRESOLVED_TEMPLATE head rule

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4562


felicity@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |3.2.0






------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4562] Excessive backtracking in UNRESOLVED_TEMPLATE head rule

Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4562





------- Additional Comments From eriker-sa@f-secure.com  2005-08-30 05:41 -------
Created an attachment (id=3109)
 --> (http://bugzilla.spamassassin.org/attachment.cgi?id=3109&action=view)
Patch against rules/20_head_tests.cf

Here is a proper patch against 3.0.4



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

[Bug 4562] Excessive backtracking in UNRESOLVED_TEMPLATE head rule

Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4562


jm@jmason.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From jm@jmason.org  2007-01-03 06:37 -------
this has already been fixed -- the code no longer uses any kind of backtracking
at all, which is nice



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.