Article View: news.software.nntp
Article #59469Re: innd perl filter slowdown ?
From: Russ Allbery
Date: Fri, 05 Jul 2002 15:40
Date: Fri, 05 Jul 2002 15:40
29 lines
2203 bytes
2203 bytes
Miquel van Smoorenburg <miquels@cistron.nl> writes:
> It turned out to be the perl filter - "ctlinnd perl n" fixed it. On one
> server, I run cleanfeed - on the other (our feeder) I run a stripped
> down filter that just checks for binary-in-nonbin groups using the
> regexp from cleanfeed, and enforces usenet2/bofh policies. Both servers
> behave the same.
Which binary regex are you using? Some of them have a nasty bug where
they can go into exponential backtracking on certain articles. There was
some extensive discussion of that here a year or more ago. The version
I'm currently using is:
# How we determine if a post is a binary.
sub is_binary {
($hdr{__BODY__} =~ m%(?:^[ \t>]*(?>M[\x20-\x60]{59,60})[ \r]*\n){40}%mo
|| $hdr{__BODY__} =~ m%(?:^[ \t>]*[A-Za-z0-9+/]{59,76}[ \r]*\n){40}%mo);
}
The (?>...) bit in there is the important bit, since it prevents
backtracking inside the construct. There are a few other ways of
rewriting the regex that also work.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Technical Details
Message-ID:
<yl65zunpyc.fsf@windlord.stanford.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mailReferences:
<ag3tc5$lcl$1@ncc1701.cistron.net>Show Full Headers
Complete Article Headers
Message-ID: <yl65zunpyc.fsf@windlord.stanford.edu> Subject: Re: innd perl filter slowdown ? Date: Fri, 05 Jul 2002 08:40:11 -0700 From: Russ Allbery <rra@stanford.edu> References: <ag3tc5$lcl$1@ncc1701.cistron.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mail Newsgroups: news.software.nntp Organization: The Eyrie Lines: 28 NNTP-Posting-Host: windlord.stanford.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.Stanford.EDU 1025883611 18088 171.64.13.23 (5 Jul 2002 15:40:11 GMT) X-Complaints-To: news@news.stanford.edu User-Agent: Gnus/5.090005 (Oort Gnus v0.05) XEmacs/21.4 (Common Lisp, sparc-sun-solaris2.6) Cancel-Lock: sha1:zrAMOKflYmmsNwspmWhH+GBzjmU=