🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #59495

Re: innd perl filter slowdown ?

#59495
From: Miquel van Smoorenburg
Date: Sat, 06 Jul 2002 18:46
51 lines
3030 bytes
In article <yl65zunpyc.fsf@windlord.stanford.edu>,
Russ Allbery  <rra@stanford.edu> wrote:
>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);
>}

Okay, found it. The one from cleanfeed, condensed down to two lines, is:

sub is_binary {
 ($hdr{__BODY__} =~ /(?:^[ \t|>]*(?>M[\x20-\x60]{60,61})\s*\r?\n){40}/mo
  or $hdr{__BODY__} =~ /(?:^[ \t|>]*(?>[A-Za-z0-9\+\/]{59,76})\s*\r?\n){40}/mo);}

I found an article of 139 lines that takes some seven seconds to be processed
by the expression above. Replacing

	\s*\r?
with
	[ \r]*

as in Russ' version, makes the problem go away.

The slow article triggering this bug is <MPG.8f86beb28999@news.mts.net>
Anytime a flood of articles like this hit usenet, cleanfeed
throws a fit .. it's some kind of sporgery, apparently.

Marco, you might want to test the latest cleanfeed against this
article.

Also, the regexp from cleanfeed and Russ differ slightly in that
a) cleanfeed: ^[ \t|>] Russ: ^[ \t>]	(quoting, I suppose)
b) cleanfeed: {60,61}  Russ: {59,60}

Which one is right? One of them appears to be off-by-one ?

Mike.
Technical Details
Message-ID: <ag7dv1$ccm$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!news.tele.dk!small.news.tele.dk!62.216.30.27!newsgate.cistron.nl!news2.cistron.nl!news.cistron.nl!not-for-mail
References: <ag3tc5$lcl$1@ncc1701.cistron.net> <yl65zunpyc.fsf@windlord.stanford.edu>

Show Full Headers
Complete Article Headers
Message-ID: <ag7dv1$ccm$1@ncc1701.cistron.net>
Subject: Re: innd perl filter slowdown ?
Date: Sat, 06 Jul 2002 18:46:57 +0000
From: "Miquel van Smoorenburg" <miquels.at.cistron.nl.spamtrap@netscum.nl>
References: <ag3tc5$lcl$1@ncc1701.cistron.net> <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!news.tele.dk!small.news.tele.dk!62.216.30.27!newsgate.cistron.nl!news2.cistron.nl!news.cistron.nl!not-for-mail
Newsgroups: news.software.nntp
Organization: Cistron
Lines: 50
NNTP-Posting-Host: traveler.cistron-office.nl
Content-Type: text/plain; charset=iso-8859-15
X-Trace: ncc1701.cistron.net 1025981217 12694 62.216.29.67 (6 Jul 2002 18:46:57 GMT)
X-Complaints-To: abuse@cistron.nl
NNTP-Posting-Date: Sat, 6 Jul 2002 18:46:57 +0000 (UTC)
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
Originator: miquels@cistron-office.nl (Miquel van Smoorenburg)